Group: Windows Multimedia - Library: winmm
Playing WAV files on InteractiveChange
BOOL PlaySound(
LPCTSTR pszSound,
HMODULE hmod,
DWORD fdwSound
);
DECLARE INTEGER PlaySound IN winmm;
STRING pszSound,;
INTEGER hmod,;
LONG fdwSound
pszSound A string that specifies the sound to play. The maximum length, including the null terminator, is 256 characters.
hmod Handle to the executable file that contains the resource to be loaded. This parameter must be NULL unless SND_RESOURCE is specified in fdwSound.
fdwSound Flags for playing the sound.
Returns TRUE if successful or FALSE otherwise.
For playing system sounds rather than sounds stored in WAV files, it is better to declare this function as follows:
DECLARE INTEGER PlaySound IN winmm;
LONG pszSound, INTEGER hmod, LONG fdwSound
Below is FoxPro equivalent to sndAlias("S", "W") macro (SND_ALIAS_SYSTEMWELCOME) :
nSoundId = BITOR(buf2dword(PADR("S",4,CHR(0))),;
BITLSHIFT(buf2dword(PADR("W",4,CHR(0))),8)) && returns 22355
This will play the SND_ALIAS_SYSTEMWELCOME sound:
= PlaySound(22355, 0, BITOR(SND_ALIAS_ID, SND_ASYNC))
See also: sndPlaySound.