我想用VB开一首歌或声音,但我不想让它弹出任何播放窗口,可以吗?
注意:不要任何弹出窗口!!!
參考答案:你这要用到函数,下面是给你找的一两个实例.还不错.
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 Command1_Click()
PlaySound "C:\WINDOWS\Media\chimes.wav"
End Sub
Function PlaySound(ByVal FileName As String) As Boolean
Dim cmd As String, exName As String
exName = Right(FileName, 3)
mciSendString "close " & exName, 0, 0, 0
cmd = "open " & FileName & " alias " & exName
mciSendString cmd, 0, 0, 0
PlaySound = mciSendString("play " & exName, 0, 0, 0)
End Function