正文

如何用API及MMSYSTEM.DLL播放WAV文件2006-02-15 22:09:00

【评论】 【打印】 【字体: 】 本文链接:http://blog.pfan.cn/stef/10148.html

分享到:

Declare Function sndPlaySound% Lib "MMSYSTEM.DLL" (ByVal lpszSoundName$, ByVal wFlags%)Global Const SND_SYNC = &H0000Global Const SND_ASYNC = &H0001Global Const SND_NODEFAULT = &H0002Global Const SND_LOOP = &H0008Global Const SND_NOSTOP = &H0010' Paramaters:' lpszSoundName$'  Specifies the name of the sound to play. The function first' searches the [sounds] section of the WIN.INI file for an entry' with the specified name, and plays the associated waveform sound' file. If no entry by this name exists, then it assumes the' specified name is the name of a waveform sound file. If this' parameter is NULL, any currently playing sound is stopped.' That is, use a 0& to provide a NULL value.' wFlags%'  Specifies options for playing the sound using one or more' of the following flags: ' SND_SYNC: The sound is played synchronously and the function' does not return until the sound ends.' SND_ASYNC: The sound is played asynchronously and the function' returns immediately after beginning the sound.' SND_NODEFAULT: If the sound cannot be found, the function returns' silently without playing the default sound.' SND_LOOP: The sound will continue to play repeatedly until' sndPlaySound is called again with the lpszSoundName$ parameter' set to null.' You must also specify the SND_ASYNC flag to loop sounds.' SND_NOSTOP: If a sound is currently playing, the function will' immediately return False without playing the requested sound.' Add the following code to the appropriate routine:Dim SoundName$Dim wFlags%Dim x%SoundName$ = "c:\windows\tada.wav" ' The file to playwFlags% = SND_ASYNC Or SND_NODEFAULTx% = sndPlaySound(SoundName$,wFlags%)---------------------------------------------------

阅读(2867) | 评论(0)


版权声明:编程爱好者网站为此博客服务提供商,如本文牵涉到版权问题,编程爱好者网站不承担相关责任,如有版权问题请直接与本文作者联系解决。谢谢!

评论

暂无评论
您需要登录后才能评论,请 登录 或者 注册