Click here to Skip to main content
15,891,787 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!
Posted
Updated 3-Jun-10 12:46pm
v4

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.
 
Share this answer
 
Google on Mutex!
It is used to make sure only one instance of an application runs at a time!
 
Share this answer
 
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.
http://www.vbdotnetheaven.com/UploadFile/ksasikumar/NetRemoting11152005081901AM/NetRemoting.aspx[^]
 
Share this answer
 
v2

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