View Single Post
  #3 (permalink)  
Old 01-15-2007, 10:53 AM
Paul G. Tobey [eMVP]
Newsgroup Contributor
 
Posts: n/a
Re: Passing command line arguments

Of course not. You don't expect the system to call Main() again on a
running program, right? CreateProcess() won't help with this. It could
never work that way. You could create your own method of communicating with
an already-running program and send it information that would otherwise be
on the command line in that way (a user-defined message sent to the main
window, for example, or a point-to-point message queue to which you send the
new data).

Paul T.

"Cornel Gligan" <a@b.c> wrote in message
news:e9yWR2YAHHA.3396@TK2MSFTNGP02.phx.gbl...
> Hi!
>
> I implemented an application (named "WinCEApp") using C++ and Windows CE
> SDK, that used "ShellExecuteEx" method (see
> http://msdn.microsoft.com/library/de...lExecuteEx.asp)
> to launch an other application (named "DotNetCFApp") implemented in C#
> with .Net Compact Framework. "ShellExecuteEx" mothod passed to
> "DotNetCFApp" application a command line argument.
>
> If "DotNetCFApp" application is closed, in this case, when "WinCEApp"
> application calls "ShellExecuteEx" method, "DotNetCFApp" is opened with
> the correct command line argument passed through "Main(string[] args)"
> method.
>
> But if "DotNetCFApp" application is already opened (for eg. in minimize
> state), in this case, when WinCEApp" application calls "ShellExecuteEx"
> method with a new command line argument, "DotNetCFApp" application is
> activated but the new command line argument is not passed. After the last
> call of "ShellExecuteEx" method I checked the command line argument of
> "DotNetCFApp" using P/Invoke for "GetCommandLine" method (see
> http://msdn.microsoft.com/library/de...ommandline.asp)
> and it returned the old command line argument passed form the first call
> of "ShellExecuteEx, not the new one.
>
> I tried to replace "ShellExecuteEx" method with "CreateProcess" method
> (see
> http://msdn.microsoft.com/library/de...ateprocess.asp)
> but the results were the same.
>
> Is there anyone who knows how I can activate and pass the new command line
> argument to an application that is already running? You can conssider that
> both applications are written with Windows CE SDK because I can handle
> the Windows CE SDK APIs in a .Net Compact Framework application, too,
> using P/Invoke technique. So, any suggestions are wellcome!
>
> I am using Windows Mobile 5, .Net Compact Framework 1.0, Visual Studio
> 2005, Windows XP Pro.
>
> Thank you in advance!
>
> Regards,
> Cornel Gligan
>



Reply With Quote

 
Old 01-15-2007, 10:53 AM