How do you keep a permalink between two applications on the Windows platform even if one crashes and reopens?
What are some options to keep a permalink to two apps even if one crashes, so that when reopening the first one it can get the link to the second one and call methods on it.
The situation is as follows:
-
App1 (a web browser plugin) creates App2 through an object reference in the HTML page and gets a link to it so that it can make API calls to App2.
-
App1 failed, but App2 remains open.
-
When App1 reopens, it needs to get a reference to App2 (still running) so that it can continue making API calls.
All this is done as an administrator on the machine. What is the best way for App1 to get a link to the still running App2 when it reopens after a crash?
a source to share
There are many different parameters for IPC that will work.
If you are trying to make API calls from App1 to App2, you are already using some form of IPC. I would just use something like named pipes which allows any process to be used. If App2 is a channel server, App1 can connect to it, and if it fails, the new App1 can simply connect to it as a client again.
a source to share
You can try using EnumProcesses to find the running application.
There is a sample code at http://msdn.microsoft.com/en-us/library/ms682623(VS.85).aspx .
a source to share