0

I know there is a question with the following title: "Opening a file in an application that is already running"

This gives the answer to the question targeting WPF applications. I am working on a WinForms application where doubleclicking a specific file should start the program and open the file. Of course this is simple. Now when the application is already running I would like to open a file in the running application when it is doubleclicked.

To do this the application needs to be a singleton. I prefer the Mutex approach as described in this great article of "Sanity Free Coding"

Now I would like to know how to open a doubleclicked file into the running singleton WinForms applications. Any help would be appreciated.

Community
  • 1
  • 1
Enrico
  • 1,937
  • 3
  • 27
  • 40

1 Answers1

1

I think this project does what you want. Also, you should get the file opened as a parameter for your singleton instance. I have not tested it though, use another implementation but I don't need more parameters from the second instance.

Akku
  • 4,373
  • 4
  • 48
  • 67