用playsound函数 Option Explicit Private Declare Function PlaySound Lib "winmm.dll" Alias "PlaySoundA" (ByVal lpszName As String, ByVal hModule As Long, ByVal dwFlags As Long) As LongPrivate Const SND_LOOP = &H8 ' loop the sound until next sndPlaySound Private Const SND_ASYNC = &H1 ' play asynchronouslyPrivate Sub Form_Load() PlaySound "d:\Message.WAV", 0, SND_LOOP + SND_ASYNC End SubPrivate Sub Form_Unload(Cancel As Integer) PlaySound 0, 0, 0 End Sub
Option Explicit
Private Declare Function PlaySound Lib "winmm.dll" Alias "PlaySoundA" (ByVal lpszName As String, ByVal hModule As Long, ByVal dwFlags As Long) As LongPrivate Const SND_LOOP = &H8 ' loop the sound until next sndPlaySound
Private Const SND_ASYNC = &H1 ' play asynchronouslyPrivate Sub Form_Load()
PlaySound "d:\Message.WAV", 0, SND_LOOP + SND_ASYNC
End SubPrivate Sub Form_Unload(Cancel As Integer)
PlaySound 0, 0, 0
End Sub
在函数...SND_LOOP + SND_ASYNC+ SND_FILENAME
看看行没