我以c:\1.wav为例
用:
PlaySound(PSTR,HMODULE,DWORD);
PlaySound("c:\\1.wav",NULL,SND_FILENAME|SND_ASYNC);
也添加了winmm.lib
头文件加的windows.h
还是出错了!我在初始化和view类里分别添加了以上代码,都有错!应该在什么地方加啊?
报错如下:
F:\object\TestDialog\TestDialogView.cpp(62) : error C2065: 'PlaySound' : undeclared identifier
F:\object\TestDialog\TestDialogView.cpp(62) : error C2275: 'PSTR' : illegal use of this type as an expression
c:\program files\microsoft visual studio\vc98\include\winnt.h(166) : see declaration of 'PSTR'
F:\object\TestDialog\TestDialogView.cpp(62) : error C2275: 'HMODULE' : illegal use of this type as an expression
c:\program files\microsoft visual studio\vc98\include\windef.h(253) : see declaration of 'HMODULE'
F:\object\TestDialog\TestDialogView.cpp(62) : error C2275: 'DWORD' : illegal use of this type as an expression
c:\program files\microsoft visual studio\vc98\include\windef.h(141) : see declaration of 'DWORD'
F:\object\TestDialog\TestDialogView.cpp(63) : error C2065: 'SND_FILENAME' : undeclared identifier
F:\object\TestDialog\TestDialogView.cpp(63) : error C2065: 'SND_ASYNC' : undeclared identifier
Error executing cl.exe.
Creating browse info file...