R
Rune Jacobsen
Hi all,
I am working on my single instance application that now also has a URL
type associated with it, according to the Asynchronous Pluggable
Protocols information from MSDN. Now, if my application is not already
started, everything works fine. The APP setup starts my program with the
URL as the command line argument, and it displays the proper information
to the user. This works great and was a pleasure to program.
However, my challenge comes when the application is already running.
Thanks to some tips from Nicholas Paldino here on the group, I
originally handled this by using RegisterWindowMessage to obtain a
unique msg id, then I PostMessage'd it to HWND_BROADCAST in order to
tell the existing instance to show itself. Then the second instance
would simply exit.
Now, however, Windows is starting a second instance along these lines;
"C:\Program Files\MyApp\MyApp.exe" "MyProtocol://Heyheyhey/gunk"
What I need is for the second instance of the application to pass
"MyProtocol://Heyheyhey/gunk" to the existing instance before it dies.
My first idea was simply to do another RegisterWindowMessage and pass
the string as one of the parameters, but it seems after intense googling
that it's not going to be that easy.
What would you guys say is The Right Way to do something like this? My
application is in C# with VS 2003 and .Net 1.1. If possible, I would
like to make this as simple as I can, but I realize I might have to give
up that comfort to get something that actually works.
Any advice will be accepted with gratitude!
Keep up the good work!
Rune
I am working on my single instance application that now also has a URL
type associated with it, according to the Asynchronous Pluggable
Protocols information from MSDN. Now, if my application is not already
started, everything works fine. The APP setup starts my program with the
URL as the command line argument, and it displays the proper information
to the user. This works great and was a pleasure to program.
However, my challenge comes when the application is already running.
Thanks to some tips from Nicholas Paldino here on the group, I
originally handled this by using RegisterWindowMessage to obtain a
unique msg id, then I PostMessage'd it to HWND_BROADCAST in order to
tell the existing instance to show itself. Then the second instance
would simply exit.
Now, however, Windows is starting a second instance along these lines;
"C:\Program Files\MyApp\MyApp.exe" "MyProtocol://Heyheyhey/gunk"
What I need is for the second instance of the application to pass
"MyProtocol://Heyheyhey/gunk" to the existing instance before it dies.
My first idea was simply to do another RegisterWindowMessage and pass
the string as one of the parameters, but it seems after intense googling
that it's not going to be that easy.
What would you guys say is The Right Way to do something like this? My
application is in C# with VS 2003 and .Net 1.1. If possible, I would
like to make this as simple as I can, but I realize I might have to give
up that comfort to get something that actually works.

Any advice will be accepted with gratitude!
Keep up the good work!
Rune