Difference between revisions of "Microsoft Access modSystem"
Jump to navigation
Jump to search
(Created page with '=== waitForShell == ==== Declaration ==== <syntaxhighlight lang="vb"> Private Declare Function CloseHandle Lib "kernel32" ( _ ByVal hObject As Long _ ) As Long </syntaxh...') |
|||
Line 1: | Line 1: | ||
− | === waitForShell == | + | === waitForShell === |
==== Declaration ==== | ==== Declaration ==== |
Latest revision as of 13:32, 20 July 2010
waitForShell
Declaration
Private Declare Function CloseHandle Lib "kernel32" ( _
ByVal hObject As Long _
) As Long
Private Declare Function GetExitCodeProcess Lib "kernel32" ( _
ByVal hProcess As Long, _
ExitCode As Long _
) As Long
Private Declare Function OpenProcess Lib "kernel32" ( _
ByVal DesiredAccess As Long, _
ByVal InheritHandle As Long, _
ByVal ProcessId As Long _
) As Long
Code
Public Function waitForShell( _
strExecute As String, _
Optional lngWindowStyle As VbAppWinStyle = vbMinimizedFocus _
) As Long
Dim lngTaskId As Long
Dim lngHProcess As Long
Dim lngExitCode As Long
Const STILL_ACTIVE = &H103
Const PROCESS_QUERY_INFORMATION = &H400
lngTaskId = Shell(strExecute, lngWindowStyle)
lngHProcess = OpenProcess(PROCESS_QUERY_INFORMATION, False, lngTaskId)
Do
DoEvents
GetExitCodeProcess lngHProcess, lngExitCode
Loop While lngExitCode = STILL_ACTIVE
CloseHandle lngHProcess
waitForShell = lngExitCode
End Function