There's several ways to do this, here is one (DLL) that works fine on Win9x/NT/2K/XP. The SetMyHook(HWND my_window, HWND subclassed_window) function subclasses the 'subclassed_window' in another process and PostMessage to 'my_window' when it's destroyed. ReleaseMyHook() unsubclasses it.
Regards
Exactly why I wait for the Window to close instead of the process. I have noticed that when this window is closed the process is still running. This is why I watch for the window to close, then use terminate process on the running process.
I would change the code of the application, but it is a vendor application that they don't allow changes to.
It doesn't until you reboot the machine. It is a Java Applet using the MVM to run. It opens a port that I need to be closed and reopened every time, but this port is locked as long as the process it running.
1. I need to correct you: ovidiucucu had suggested this code, not Victor !
2. What does it mean "it didn't work "?
a) dwThreadID == 0 ?
b) hProcess == NULL ?
c) WaitForSingleObject doesn't return ?
In case of c) - you will need to ::TerminateProcess(hProcess );
What doesn't work is the WaitForSingleObject because it is waiting on a process that doesn't quit. I need a way to find out when the window is closed so that the process can be terminated through TerminateProcess.
* The Best Reasons to Target Windows 8
Learn some of the best reasons why you should seriously consider bringing your Android mobile development expertise to bear on the Windows 8 platform.