hi,
i'd like to do this thing in my app:
i want to have a class, a module, that: when the program app.exe be closed, it shows the msgbox program was closed!
how can i do that?
Printable View
hi,
i'd like to do this thing in my app:
i want to have a class, a module, that: when the program app.exe be closed, it shows the msgbox program was closed!
how can i do that?
What's wrong with putting the Msgbox in the form's Unload event?
I think the OP wants to monitor an external Exe and be notified when it has exited/closed? If thats the case search the forum, there are many examples already posted, , heres another one...
The attached snippet is originally form Penagate but I modified it a bit since the determination of the target application's closing is not handled correctly. This is without using a timer.
its like a launcher, that prevents ant-hack actions. and, when the process of the its over, i want that to appears a msgbox informing that the process is over. i'll see the codes that you posted here. thanks
edgemetal
thanks, your example works, thanks
If you are checking for the EXE very often, like once per second or less, you could make the routine slightly more efficient by saving and comparing just the process ID for the exe once its found.Quote:
Originally Posted by lelejau
Add to declares...
Add to the end of Sub WatchOff...Code:Private ExePID As Long
Update the Function CheckForExe...Code:ExePID = 0
Code:
For L = 0 To cbNeeded / 4
If ExePID = 0 Then
' Find matching filename and save its Process ID if found
If ProcessIDs(L) > 0 Then sTitle = CutPath(GetExePathFromPID(ProcessIDs(L)))
If LCase$(sTitle) = LCase$(ExeFile) Then
CheckForExe = True
ExePID = ProcessIDs(L)
Exit For
End If
Else ' we already know the PID of the exe so just check for matching PID.
If ExePID = ProcessIDs(L) Then
CheckForExe = True
Exit For
End If
End If
Next L