1. 程式人生 > >VB播放聲音

VB播放聲音

mod nbsp rms style span bsp call all pat

公共Modules定義:

Public Declare Function PlaySound Lib "winmm.dll" Alias "PlaySoundA" (ByVal lpszName As String, ByVal hModule As Long, ByVal dwFlags As Long) As Long
Public Function EffectSound(Effect As String) As Long
    On Error Resume Next
    Dim sEffect As String
    sEffect = IIf(Right(App.Path, 1
) = "\", App.Path, App.Path & "\") & Effect PlaySound sEffect, 0, 0 End Function

Forms中引用:

Call EffectSound("OO.wav")

VB播放聲音