ChildApp



Const STILL_ACTIVE As Long = &H103
Const PROCESS_QUERY_INFORMATION As Long = &H400
Const vbhNull As Long = 0
Declare Function OpenProcess Lib "kernel32" _
(ByVal dwDesiredAccess As Long, ByVal bInheritHandle _
As Long, ByVal dwProcessID As Long) As Long
Declare Function GetExitCodeProcess Lib "kernel32" _
(ByVal hProcess As Long, lpExitCode As Long) As Long
Declare Function CloseHandle Lib "kernel32" _
(ByVal hObject As Long) As Long
'Ritorna vero se un processo figlio avviato con Shell sta

'girando e falso se ha terminato. Il parametro e' l'handle

'restituito da Shell

Public Function IsChildRunning(ByVal idProg As Long) As Boolean
Dim hProc As Long, iRet As Long
'Prende l'handle di processo

hProc = OpenProcess(PROCESS_QUERY_INFORMATION, False, idProg)
'Controlla lo stato del processo

If hProc <> vbhNull Then GetExitCodeProcess hProc, iRet
IsChildRunning = (iRet = STILL_ACTIVE)
CloseHandle hProc
End Function


(childapp.html)- by Paolo Puglisi - Modifica del 25/3/2019