我把一段音乐给编译成了资源文件,加载到工程中,我想问问,如何播放资源文件中的音乐呢?
解决方案 »
- 关于vbs的tba不能激活输入框和输入框无光标指示的问题
- 实时错误 -2147417848(80010108) 对象Write_Date 的方法_WQIC4428失败
- 请较,如何在EXCEL,VBA中, 用函数,查找一个字符串,并返回所在行的值.
- 有一个棘手的问题,大家救救我吧!
- 我想下载CSDN的数据,请问到哪里下载?在线等待!
- 为什么会 339?
- MS10-017Excel新暴光漏洞 跪求怎么利用
- 求购小型医院管理系统源代码
- sql的多用户共享问题!
- 刚看到“深圳急缺软件人才”一文,,,,,,,,,,,
- VB如何读大的文本文件?
- vb 写的 ActiveX dll 如何才能被其它语言调用(delphi) ?
Private Const SND_ASYNC = &H1
Private Const SND_FILENAME = &H20000Private Sub Command1_Click()
'播放声音
sndPlaySound "C:\WINDOWS\Media\Windows XP 启动.wav", SND_ASYNC Or SND_FILENAME
End SubPrivate Sub Command2_Click()
'停止声音
sndPlaySound vbNullString, SND_ASYNC Or SND_FILENAME
End Sub
上面给的是随意播放和停止波文件的例子。请看下面微软的API帮助,看完后,^^什么^^都清楚了!The sndPlaySound function plays a waveform sound specified either by a filename or by an entry in the registry or the WIN.INI file. This function offers a subset of the functionality of the PlaySound function; sndPlaySound is being maintained for backward compatibility.BOOL sndPlaySound( LPCSTR lpszSound,
UINT fuSound
);
ParameterslpszSoundA string that specifies the sound to play. This parameter can be either an entry in the registry or in WIN.INI that identifies a system sound, or it can be the name of a waveform-audio file. (If the function does not find the entry, the parameter is treated as a filename.) If this parameter is NULL, any currently playing sound is stopped.fuSoundFlags for playing the sound. The following values are defined:SND_ASYNCThe sound is played asynchronously and the function returns immediately after beginning the sound. To terminate an asynchronously played sound, call sndPlaySound with lpszSoundName set to NULL.SND_LOOPThe sound plays 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_MEMORYThe parameter specified by lpszSoundName points to an image of a waveform sound in memory.SND_NODEFAULTIf the sound cannot be found, the function returns silently without playing the default sound.SND_NOSTOPIf a sound is currently playing, the function immediately returns FALSE, without playing the requested sound.SND_SYNCThe sound is played synchronously and the function does not return until the sound ends. Return ValuesReturns TRUE if successful or FALSE otherwise.ResIf the specified sound cannot be found, sndPlaySound plays the system default sound. If there is no system default entry in the registry or WIN.INI file, or if the default sound cannot be found, the function makes no sound and returns FALSE.
The specified sound must fit in available physical memory and be playable by an installed waveform-audio device driver. If sndPlaySound does not find the sound in the current directory, the function searches for it using the standard directory-search order.