ShellFunction



Dim hPrg As Long
Dim hProc As Long
Dim iRet As Long
hPrg = Shell("Word.Exe")
hProc = OpenProcess(PROCESS_ALL_ACCESS, False, hPrg)
If hProc <> hNull Then
IRet = WaitForSingleObject(hproc, INFINITE)
CloseHandle hProc
End If
'Spesso pero' non si vuole stare ad aspettare senza far nulla,

'ma si vuole sapere quando l'applicativo eseguito ha finito.

'Questo lo si puo' fare utilizzando la funzione API

'GetExitCodeProcess:

Dim hPrg As Long
Dim hProc As Long
Dim iRet As Long
hPrg = Shell("Word.Exe")
hProc = OpenProcess(PROCESS_ALL_ACCESS, False, hPrg)
If hProc <> hNull Then
GetExitCodeProcess hProc, iRet
If iRet = STILL_ACTIVE Then
' applicazione ancora in esecuzione

End If
End If

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