csLijo
csLijo

Reputation: 501

How to pass input arguments to running windows application?

I have a windows application that will work from a tray icon.

On its menu click, a windows form will appear. I also added a registry entry which will add a menu item in windows menu while selecting a file. When we click on that menu item, it will load the same windows form with the input file we clicked. Things are smooth till this point. But it is generating another exe in the task manager.

What I want to achieve here is to open the same exe which is running already, with the input parameter (here, say file path).

Upvotes: 0

Views: 2077

Answers (3)

Arash
Arash

Reputation: 3051

Simply with A little search you can find your answer

See this links :

http://social.msdn.microsoft.com/Forums/en/csharpgeneral/thread/53a2c453-3502-44bd-9f43-b07250957ed5

How to Pass a string to an exe and retrieving from the exe using Process in C#

Running EXE with parameters

For More Information google this : send parameters to another exe file in c#

Upvotes: 1

Vitaliy
Vitaliy

Reputation: 718

On application startup you should:

  • search for existing process of your application;
  • if it exists;
    • pass parameters using WCF;
  • if it doesn't exists just start application.

Upvotes: 1

Brad Bruce
Brad Bruce

Reputation: 7807

In previous projects, I've packed a string into an atom and passed it to other applications via the WM_COPYDATA message.

It may be worth looking into. I believe that was the original purpose of the message.

Upvotes: 1

Related Questions