View Single Post
  #1 (permalink)  
Old 01-15-2007, 10:53 AM
Cornel Gligan
Newsgroup Contributor
 
Posts: n/a
Passing command line arguments

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