View Single Post
Old 17-05-2005, 09:48   #2
fgmac
Member
 
Iscritto dal: Apr 2000
Messaggi: 138
Non so se ho capito bene, ma puoi provare con questo codice che ti permette di analizzare anche il codice di ritorno dell'applicativo lanciato.
Devi usare un minimo di api.

Codice:
Const STILL_ACTIVE = &H103
Const PROCESS_QUERY_INFORMATION = &H400
Private Declare Function GetExitCodeProcess Lib "kernel32" (ByVal hProcess As Long, lpExitCode As Long) As Long
Private Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)
Private Declare Function OpenProcess Lib "Kernel32.dll" (ByVal dwDesiredAccessas As Long, ByVal bInheritHandle As Long, ByVal dwProcId As Long) As Long


'lancia un processo e ne attende la chiusura intercettando il codice di uscita
Function Shell32Bit(ByVal JobToDo As String) As Long
  Dim hProcess As Long, RetVal As Long
  hProcess = OpenProcess(PROCESS_QUERY_INFORMATION, False, Shell(JobToDo, 0))
  Do
    GetExitCodeProcess hProcess, RetVal           ' Get status of process
    DoEvents
    Sleep 100
  
  Loop While RetVal = STILL_ACTIVE
  Shell32Bit = RetVal
End Function
ciao,
__________________
fgmac
fgmac è offline   Rispondi citando il messaggio o parte di esso