Stopping an application...
-
I want to add the capability to my dialog based application so when I start it, it looks to see if any other instances of the application are running. If there is one already running, that instance will be killed and the new instance will be started. How can I do this, I know I have seen it on here before but cannot find the solution. Any help? Roger Printy Software Engineer TeraNex Orlando, FL
-
I want to add the capability to my dialog based application so when I start it, it looks to see if any other instances of the application are running. If there is one already running, that instance will be killed and the new instance will be started. How can I do this, I know I have seen it on here before but cannot find the solution. Any help? Roger Printy Software Engineer TeraNex Orlando, FL
So what's exactly is the problem? Determining if another instance is running, or terminating it cleanly? Tomasz Sowinski -- http://www.shooltz.com.pl
-
So what's exactly is the problem? Determining if another instance is running, or terminating it cleanly? Tomasz Sowinski -- http://www.shooltz.com.pl
-
Both really. Like I said, I have done it before just cannot find the source code I used. Roger Printy Software Engineer TeraNex Orlando, FL
The following article by PJ Naughter deals with "single-instancing": http://www.codeproject.com/cpp/csingleinst.asp However, the code you'll find there closes the second instance (not the original one). To close the original instance, you can send a message to its main window. WM_CLOSE could work here, depending on the actions your program performs on closing. If any msgboxes are displayed (prompt for save, etc.), you can choose to use some private application message. Tomasz Sowinski -- http://www.shooltz.com.pl
-
The following article by PJ Naughter deals with "single-instancing": http://www.codeproject.com/cpp/csingleinst.asp However, the code you'll find there closes the second instance (not the original one). To close the original instance, you can send a message to its main window. WM_CLOSE could work here, depending on the actions your program performs on closing. If any msgboxes are displayed (prompt for save, etc.), you can choose to use some private application message. Tomasz Sowinski -- http://www.shooltz.com.pl