Private Const SW_SHOWNORMAL = 1Private Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" ( _ ByVal Hwnd As Long, _ ByVal lpszOp As String, _ ByVal lpszFile As String, _ ByVal lpszParams As String, _ ByVal lpszDir As String, _ ByVal FsShowCmd As Long) _ As Long Private Declare Function GetDesktopWindow Lib "user32" () As LongPrivate Sub File1_DblClick() Call ShellExecute(GetDesktopWindow, "Open", IIf(Right$(File1.Path, 1) = "\", File1.Path, File1.Path & "\") & File1.FileName, "", "c:", SW_SHOWNORMAL) End Sub
如打开一个wchsoft.bmp
在程序中通过WINEXEC调用:start wchsoft.bmp
不信你到DOS(非纯DOS)下试一试
ByVal Hwnd As Long, _
ByVal lpszOp As String, _
ByVal lpszFile As String, _
ByVal lpszParams As String, _
ByVal lpszDir As String, _
ByVal FsShowCmd As Long) _
As Long
Private Declare Function GetDesktopWindow Lib "user32" () As LongPrivate Sub File1_DblClick()
Call ShellExecute(GetDesktopWindow, "Open", IIf(Right$(File1.Path, 1) = "\", File1.Path, File1.Path & "\") & File1.FileName, "", "c:", SW_SHOWNORMAL)
End Sub