Private Declare Function GetDesktopWindow Lib "user32" () 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 Declare Function GetModuleFileName Lib "kernel32" Alias "GetModuleFileNameA" (ByVal hModule As Long, ByVal lpFileName As String, ByVal nSize As Long) As Long
Sub openApp(path)
Dim P, I, DirPath, ExeName
P = Split(path, "\")
For I = To UBound(P) -
DirPath = DirPath & P(I) & "\"
Next
ExeName = P(UBound(P))
ShellExecute GetDesktopWindow, "open", ExeName, vbNullString, DirPath,
End SubFunction appPath()
str = string(, )
GetModuleFileName , str, len(str)
appPath = Replace(str, split(str, "\")(ubound(split(str, "\"))), "")
End Function
上面分别是启动指定目录下的应用程序以及查找应用程序所在的当前路径~~~