VBA/Excel/Access/Word/Windows API/MDI Sound

Материал из VB Эксперт
Перейти к: навигация, поиск

Play MDI sound file

 
Private Declare Function PlaySound Lib "winmm.dll" Alias "PlaySoundA" (ByVal lpszName As String, ByVal hModule As Long, ByVal dwFlags As Long) As Long
Private Declare Function mciExecute Lib "winmm.dll" (ByVal lpstrCommand As String) As Long
Const SND_SYNC = &H0
Const SND_ASYNC = &H1
Const SND_FILENAME = &H20000
Sub GetFile()
    call mciExecute ("play c:\a.MDI" )
    Call PlaySound("c:\a.wav", 0&, SND_ASYNC Or SND_FILENAME)
End Sub
Sub StopMIDI()
    mciExecute ("stop c:\a.MDI")
End Sub