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 LongPrivate Sub Command2_Click()
ShellExecute Me.hwnd, "Open", "aa.exe", "", App.Path, 1
End Sub
ShellExecute Me.hwnd, "Open", "aa.exe", "", App.Path, 1
End Sub
a=shell("盘符,路径,文件名") '注意用引号扩起来.
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 Declare Function GetDesktopWindow Lib "user32" () As Long
然后:Private Sub Command1_Click()
ShellExecute(GetDesktopWindow, "Open", "C:\FileName.exe", "", "", 1)
End Sub
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 Declare Function GetDesktopWindow Lib "user32" () As Long
'然后到你想要用的地方使用
Private Sub listbox_Click()
ShellExecute(GetDesktopWindow, "Open", "文件路径", "", "", 1)
End Sub
‘格式,参照有关书集