- 注册时间
- 2009-5-28
- 最后登录
- 2010-6-30
- 在线时间
- 37 小时
- 鹏币
- 358
- 阅读权限
- 30
- 积分
- 393
- 帖子
- 45
- 主题
- 0
- 精华
- 0
- UID
- 2426
 
|
发表于 2009-5-31 13:19:55
|显示全部楼层
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 );Parameters
pszSound
A string that specifies the sound to play. The maximum length, including the null terminator, is 256 characters. 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.
.............................................
此问题,还是msdn说的清楚: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
就是第一个参数是一个文件名还是资源id,取决于第三个参数,由于你第三个参数是SND_RESOURCE,所以第一个参数不能用文件名形式,而要采用资源id这种形式! |
|