Passing parameter to a current running process.

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • wesley

    Passing parameter to a current running process.

    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


  • Nick Holmes

    #2
    Re: Passing parameter to a current running process.

    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.ex e /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.

    "wesley" <wes@inthemix.c om.au> wrote in message
    news:OrdDQjjQEH A.808@tk2msftng p13.phx.gbl...[color=blue]
    > Hello,
    >
    > How do I pass object to the current running process? For example my[/color]
    assembly[color=blue]
    > 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
    >
    >[/color]


    Comment

    Working...