注册 登录
编程论坛 VC++/MFC

这段代码出错怎么解决

shn521 发布于 2010-09-30 17:51, 784 次点击
#include <mmsystem.h>
#pragma comment(lib,"winmm.lib")

void CSoundDlg::OnHScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar)
{
    // TODO: Add your message handler code here and/or call default
    DWORD pos;
    int scrollpos;
    int scrollpos;
    if(pScrollBar->m_hWnd==m_left.m_hWnd)
    {
        scrollpos=m_left.GetPos();
        ::waveOutGetVolume(0,&pos);
        pos=pos&0x0000ffff|(scrollpos<<8);
        ::waveOutSetVolume(0,pos);
    }
    if(pScrollBar->m_hWnd==m_right.m_hWnd)
    {
        scrollpos=m_right.GetPos();
        ::waveOutGetVolume(0,&pos);
        pos=pos&0xffff0000|(scrollpos<<24);
        ::waveOutSetVolume(0,pos);
    }
    CDialog::OnHScroll(nSBCode, nPos, pScrollBar);
}
--------------------Configuration: Sound - Win32 Debug--------------------
Compiling...
StdAfx.cpp
c:\program files (x86)\microsoft visual studio\vc98\include\mmsystem.h(114) : error C2146: syntax error : missing ';' before identifier 'MMVERSION'
c:\program files (x86)\microsoft visual studio\vc98\include\mmsystem.h(114) : fatal error C1004: unexpected end of file found

感谢
2 回复
#2
东海一鱼2010-09-30 21:23
#include <mmsystem.h>
#pragma comment(lib,"winmm.lib")
不要断章取义,看看前面的包含文件或定义宏是否与mmsystem.h中的定义冲突。
#3
shn5212010-10-01 15:16
以下是引用东海一鱼在2010-9-30 21:23:36的发言:

#include
#pragma comment(lib,"winmm.lib")
不要断章取义,看看前面的包含文件或定义宏是否与mmsystem.h中的定义冲突。
#include <afxwin.h> // MFC core and standard components
#include <afxext.h> // MFC extensions
#include <afxdisp.h> // MFC Automation classes
#include <afxdtctl.h> // MFC support for Internet Explorer 4 Common Controls
#ifndef _AFX_NO_AFXCMN_SUPPORT
#include <afxcmn.h>
#include <mmsystem.h>
#pragma comment(lib,"winmm.lib")

我什么把#include <mmsystem.h>
#pragma comment(lib,"winmm.lib")放在后面就能运行了,放在前面就不行呢
1