Declare Function sndPlaySound Lib "MMSYSTEM.DLL"(ByVal lpszSoundName _ as String,ByVal wF1ags as Integer) as Integer用api函数启动时进行播放.
Private Declare Function sndPlaySound Lib "winmm.dll" Alias "sndPlaySoundA" (ByVal lpszSoundName As String, ByVal uFlags As Long) As Long Private Const SND_ASYNC = &H1 ' play asynchronously Private Const SND_NODEFAULT = &H2 sub form_load() Dim Flag As Long Flag = SND_ASYNC Or SND_NODEFAULT sndPlaySound 文件路径, Flag end sub
很简单! 楼上的就很正确! 我有个简单的! Private Declare Function mciSendString Lib "winmm.dll" Alias "mciSendStringA" (ByVal lpstrCommand As String, ByVal lpstrReturnString As String, ByVal uReturnLength As Long, ByVal hwndCallback As Long) As Long Private Sub Form_load() Dim Res As Integer, Ret As String * 1024 Res = mciSendString("play " & App.path & "\2.mp3", Ret, 1024, 0) '整首播放 End Sub
Private Const SND_ASYNC = &H1 ' play asynchronously
Private Const SND_NODEFAULT = &H2 sub form_load()
Dim Flag As Long
Flag = SND_ASYNC Or SND_NODEFAULT
sndPlaySound 文件路径, Flag
end sub
楼上的就很正确!
我有个简单的!
Private Declare Function mciSendString Lib "winmm.dll" Alias "mciSendStringA" (ByVal lpstrCommand As String, ByVal lpstrReturnString As String, ByVal uReturnLength As Long, ByVal hwndCallback As Long) As Long
Private Sub Form_load()
Dim Res As Integer, Ret As String * 1024
Res = mciSendString("play " & App.path & "\2.mp3", Ret, 1024, 0) '整首播放
End Sub
MMControl1.Orientation = mciOrientHorz
MMControl1.DeviceType = "sequencer"
MMControl1.Notify = False
MMControl1.Shareable = False
MMControl1.Wait = True MMControl1.FileName = App.Path & "\1.mid"
MMControl1.Command = "open"
MMControl1.Command = "play"End SubPrivate Sub Form_Unload(Cancel As Integer)
MMControl1.Command = "stop"
MMControl1.Command = "close"End Sub
感谢各位朋友相助,我自己也找到一个。MID