Click here to Skip to main content
15,901,001 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
So .. I have I file association ".snippt" which when double clicked will instantiate a new window of my application, and load the arguments into the app. However if click another file I want it to pass the arguments to the already running application and load these arguments into the app. Then terminate the new window.

It is just like if you have a media player and you double click a .mp3 it will load that mp3 to your playlist and NOT open up a new window.

Thanks :)
Posted

1 solution

Windows allways starts a new instance of a program to handle this, so you have to check if an instance of your app is all ready running.
If it is, then you need to talk to it and pass the arguments over.

You can find and switch control to an existing instance quite easily: A simple way to ensure only one instance is running.[^] will show you how.

Passing your parameters over is a bit harder...
Pipes are probably the easiest way: Inter-Process Communication in .NET Using Named Pipes, Part 1[^] It may seem a litle overkill, but the sample is pretty simple.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900