Invoking a Winforms app form as a custom protocol handler ( one instance only )

Viewed 20

I have a C# Winforms application which I need to invoke on certain system events;

  • the user clicks a link with a custom protocol of mylink:
  • the user opens a file with an extension of .mylink

The registry settings are done, and the app launches properly on these events. However I do not want multiple instances of the app instantiated. If the app is already running, it should receive a notification from Windows that a new file/protocol event has occurred that it should process.

In the past this was done with DDE. The app would be setup as a DDE server, and Windows explorer would send a DDE message. But that was... 20 years ago. Is there a replacement process for these shell-to-application invoke events?

I've been digging through SO and MS docs and have had no luck finding guidance on this. Pipes have largely replaced DDE, but I haven't found a mechanism that defines pipe communication between Explorer and a registered protocol handler / filetype handler.

If I'm forced to I could create a bootstrap handler app that launches on every invocation event and then launches or establishes a pipe to my main app... this process seems obtuse though, and was not needed with DDE. I'm hoping there's a better way?

0 Answers
Related