Click here to Skip to main content
14,974,887 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Do any of you know how to pass command line argument to the first instance? I want that whenever user opens a second instance of an application, then I close second instance internally and pass the commandline arguments to the first instance?

I am already using a Mutex. My question is: How do I pass the Command-Line Arguments to the First instance? Sorry, I meant to specify that I was using a Mutex already. D:

It would help me a lot. Thanks!
Updated 3-Jun-10 12:46pm

You have to use Mutex for ensuring that your application will have only a single instance. This article[^] will give you some idea about single instances.
Google on Mutex!
It is used to make sure only one instance of an application runs at a time!
One possible solution could be to have the second instance create a file containing the argument value and save the file to a location that the first instance monitors.

Another way may be to use Remoting to 'talk' between instances.[^]

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