(急)
还有一个问题是给MDIForm1窗体添加背景音乐,我试用了很多方法都不行例如如下:
模块代码:
Public Declare Function sndPlaySound Lib "winmm.dll" Alias "sndPlaySoundA" (ByVal lpszSoundName As String, ByVal uFlags As Long) As Long
Public Function PlaySound(File As String)
Const SND_SYNC = &H0
Const SND_ASYNC = &H1
Const SND_NODEFAULT = &H2
Const SND_LOOP = &H8
Const SND_NOSTOP = &H10
wFlags% = SND_ASYNC Or SND_NODEFAULT
Svar = sndPlaySound(App.Path & "\" & File & ".wav", wFlags%)
End Function
窗体代码:
Private Sub Form_Load()
PlaySound "文件名(不带扩展名)"
End Sub
提示wFlags%为定义
还有一种方法是:
添加mmcontrol控件,在引用中Microsoft Multimedia Control 6.0(sp3)
load 中
MMControl1.Notify = False
MMControl1.Wait = True
MMControl1.Shareable = False
MMControl1.DeviceType = "WaveAudio"
MMControl1.FileName = "D:\PlatformTicket\Windows 登录音.wav"
MMControl1.Command = "Open"
MMControl1.Command = "Play"
然后可以在定时器里
If MMControl1.mode = 525 Then '检查是否停止
MMControl1.Command = "Prev"
MMControl1.Command = "Play"
End If
进行循环播放
最后在unload中
MMControl1.Command = "Close"
关闭播放器
问题是怎么在MDIForm1窗体里添加mmcontrol控件