|
-
July 2nd, 2009, 09:25 PM
#1
Detect when another program closes
I want to be able to detect when another program exits. For example, if i exit my browser, i want my program to detect this and launch another process. How do i do this?
-
July 3rd, 2009, 02:33 AM
#2
Re: Detect when another program closes
If you are the one who start the process, you have the Process instance and you can wait for its exit. Otherwise (but there definitelly must be a better solution) you could periodically check the list of running process and if the one which you are interested in is there any more, you can suppose that it has finished.
- Make it run.
- Make it right.
- Make it fast.
Don't hesitate to rate my post. 
-
July 3rd, 2009, 02:18 PM
#3
Re: Detect when another program closes
If the application is not launched from your own program then another way would be to hook into the application in question here and trap WM_CLOSE message, but that would require good understanding of APIs.
-
July 3rd, 2009, 02:45 PM
#4
Re: Detect when another program closes
 Originally Posted by Shuja Ali
If the application is not launched from your own program then another way would be to hook into the application in question here and trap WM_CLOSE message, but that would require good understanding of APIs.
oh yes, I've tried it once ;] and I managed to crash or hang Vista many many times
win7 x86, VS 2008 & 2010, C++/CLI, C#, .NET 3.5 & 4.0, VB.NET, VBA... WPF is comming
remeber to give feedback  you think my response deserves recognition? perhaps you may want to click the Rate this post link/button and add to my reputation
private lessons are not an option so please don't ask for help in private, I won't replay
if you use Opera and you'd like to have the tab-button functionality for the texteditor take a look at my Opera Tab-UserScirpt; and if you know how to stop firefox from jumping to the next control when you hit tab let me know
-
July 4th, 2009, 03:29 AM
#5
Re: Detect when another program closes
I think you could use the PeekMessage or GetMessage APIs to determine the WM_CLOSE event, it is a bit tricky though...
I'd also periodically loop through all running processes to determine this.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|