我用VB制作了一个音乐播放器,但是播放的时候却没有声音,是怎么回事啊!下面是代码 麻烦大家看下那里出错
PrivateDeclareFunctionmciSendStringLib"winmm.dll"Alias"mciSendStringA"(ByVallpstrComm...
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 a As String
Private Sub Command1_Click()
On Error GoTo b
CommonDialog1.ShowOpen
If CommonDialog1.FileName <> "" Then
a = CommonDialog1.FileName
End If
Me.Caption = CommonDialog1.FileName & "-正在播放"
b:
End Sub
Private Sub Command2_Click()
If a = "" Then
Command1_Click
End If
mciSendString "Play " & a, 0&, 0, 0
End Sub
Private Sub Command3_Click()
mciSendString "Pause " & a, 0&, 0, 0
End Sub
Private Sub Command4_Click()
mciSendString "Stop " & a, 0&, 0, 0
mciSendString "Close " & a, 0&, 0, 0
Unload Me
End Sub 展开
Private a As String
Private Sub Command1_Click()
On Error GoTo b
CommonDialog1.ShowOpen
If CommonDialog1.FileName <> "" Then
a = CommonDialog1.FileName
End If
Me.Caption = CommonDialog1.FileName & "-正在播放"
b:
End Sub
Private Sub Command2_Click()
If a = "" Then
Command1_Click
End If
mciSendString "Play " & a, 0&, 0, 0
End Sub
Private Sub Command3_Click()
mciSendString "Pause " & a, 0&, 0, 0
End Sub
Private Sub Command4_Click()
mciSendString "Stop " & a, 0&, 0, 0
mciSendString "Close " & a, 0&, 0, 0
Unload Me
End Sub 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询