Passing parameter to a current running process.

W

wesley

Hello,

How do I pass object to the current running process? For example my assembly
is called program.exe. Once program.exe is running sometime I want to call
it again ie:

program.exe /m do_stuff

Now how do I pass that "do_stuff" to the currently running instance?

At the moment I use the EnumWindows Win32 API call to find the current
running instance and set it to foreground.

Thanks,

/wes
 
N

Nick Holmes

You need to establish some form of inter-process communication (IPC), and
basically have the process actually start listening for this inbound data.
There are many forms of IPC, the correct one to use depends on exactly what
you want to do, and the topology of you application.

Calling "program.exe /m do_stuff" typically looks like a non-starter,
because it will create a new process. However, if you absolutely must pass
the parameters like this, you can check to see if an instance of you process
is already running, and if so, pass the parameter to it, and shut down. Its
not the simplest way to go, but it can be made to work.

Nick.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top