Passing parameter to a current running process.

  • Thread starter Thread starter wesley
  • Start date Start date
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
 
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.
 
Back
Top