满意答案
windows下面可以使用API函数 BOOL PlaySound(
LPCSTR pszSound,
HMODULE hmod,
DWORD fdwSound
);
下面是抄的msdn的:
Parameters
pszSound
A string that specifies the sound to play. If this parameter is NULL, any
currently playing waveform sound is stopped. To stop a non-waveform sound,
specify SND_PURGE in the fdwSound parameter.
Three flags in fdwSound (SND_ALIAS, SND_FILENAME, and SND_RESOURCE)
determine whether the name is interpreted as an alias for a system event, a
filename, or a resource identifier. If none of these flags are specified,
PlaySound searches the registry or the WIN.INI file for an association
with the specified sound name. If an association is found, the sound event is
played. If no association is found in the registry, the name is interpreted as a
filename.
hmod