我只是想在游戏结束时放一首歌,所以我用了PlaySound()API函数,可是,这在WIN32工程里很正常,只用加WINMM.lib,可是在MFC里我也这样做,可是就不行,为什?
我这样用
::PlaySound(),参数我不记得了,错误提示是,这个函数不认。

解决方案 »

  1.   

    警告如下:
    G:\?ú·?\wzq\wzqDlg.cpp(718) : error C2039: 'PlaySound' : is not a member of '`global namespace''
    G:\?ú·?\wzq\wzqDlg.cpp(718) : error C2065: 'PlaySound' : undeclared identifier
      

  2.   


      Header: Declared in mmsystem.h.
      Import Library: Use winmm.lib.
      PlaySound
    The PlaySound function plays a sound specified by the given filename, resource, or system event. (A system event may be associated with a sound in the registry or in the WIN.INI file.) BOOL PlaySound(
      LPCSTR pszSound,  
      HMODULE hmod,     
      DWORD fdwSound    
    );
     
    Return Values
    Returns TRUE if successful or FALSE otherwise.Res
    The sound specified by pszSound must fit into available physical memory and be playable by an installed waveform-audio device driver. PlaySound searches the following directories for sound files: the current directory; the Windows directory; the Windows system directory; directories listed in the PATH environment variable; and the list of directories mapped in a network. For more information about the directory search order, see the documentation for the OpenFile function.If it cannot find the specified sound, PlaySound uses the default system event sound entry instead. If the function can find neither the system default entry nor the default sound, it makes no sound and returns FALSE.
      

  3.   

    谢了阿,我只是加了mmsystem.h,
    可是我在WIN32工程里就不用加,那里只是用加上WINMM.lib就可以了阿,不过那里有windows.h文件,我像可能是这的原因,可是在MFC里我加上windows.h就不行。
    再来我就给你分了~~~
      

  4.   

    so u'd check the difference of details :)