|
Private Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)
Private Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" (ByVal hWnd As Long, ByVal lpOperation As String, ByVal lpFile As String, ByVal lpParameters As String, ByVal lpDirectory As String, ByVal nShowCmd As Long) As Long
Private Sub Command1_Click()
Sleep (1000)
ShellExecute 0, "Open", "d:\test.mp3", "", "", SW_SHOW
End Sub
以上代码放到commandbutton的click事件里运行正常,API申明要放到最上面
VB6下测试正常,改成sleep(10000)后10秒后启动播放。
[ 本帖最后由 kevinchengcw 于 2010-10-24 11:55 编辑 ] |
|