|
| |||
| 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 |
| |||
| 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 > |
| Bookmarks |
| Thread Tools | |
| |
| | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Command Line command for Start>Run and Regional Settings | Richhall | Windows XP | 2 | 10-17-2008 03:50 AM |
| Passing command line argument via Windows Shortcut | Peter Lu | Windows XP | 4 | 09-19-2007 02:25 AM |
| Passing command line argument via Windows Shortcut | Peter Lu | Windows XP | 0 | 09-19-2007 02:24 AM |
| Invalid Command Line arguments??? | Jenna | Windows Vista | 11 | 09-09-2007 03:50 AM |
| XP problem passing command arguments with spaces | Ron G | Windows XP | 3 | 01-21-2007 08:30 AM |
| New To Technology Questions? | Do You Need Help with Your Computer or Device? | Do You Need Help with this site? |