需要注意的是,在 shell 程序未完成前,你的程序不能做任何事,请小心为之
http://bbs.office-cn.net/dispbbs.asp?boardid=150&ID=7623
【laviewpbt】:
Private Declare Function WaitForSingleObject Lib "kernel32" (ByVal hHandle As Long, ByVal dwMilliseconds As Long) As Long Private Declare Function CloseHandle Lib "kernel32" (ByVal hObject As Long) As Long Private Declare Function ShellExecuteEx Lib "shell32.dll" Alias "ShellExecuteExA" (lpInfo As Any) As Long
Private Type SHELLEXECUTEINFO cbSize As Long fMask As Long hwnd As Long lpVerb As String lpFile As String lpParameters As String lpDirectory As String nShow As Long hInstApp As Long ' Optional members lpIDList As Long lpClass As String hkeyClass As Long dwHotKey As Long hIcon_OR_Monitor As Long hProcess As Long End Type
Private Sub Form_Load() Dim si As SHELLEXECUTEINFO si.cbSize = Len(si) si.lpVerb = "open" si.lpFile = "notepad.exe" si.lpParameters = "" si.lpDirectory = "" si.nShow = 5 'SW_SHOW si.fMask = &H40 'SEE_MASK_NOCLOSEPROCESS ShellExecuteEx si If si.hProcess <> 0 Then WaitForSingleObject si.hProcess, &HFFFFFFFF ' 无限等待, 直到程式结束 CloseHandle si.hProcess MsgBox "程序运行完毕!" End If End Sub |
上一页 [1] [2] [3]

【责编:michael】