|
|
User login
Feeds |
How to pass command line arguments
|
|||||
| Tue, 2005-08-09 08:47 | |
|
I want to know how a background application can pass any command line argument when opening an application .
Basically i am using a watchdog.exe that is running all the time on background monitoring telephone events.On a particular event it runs main application( say test.app) that can also be run manually by user. Now problem is that i had some requirement so that i need to know whether test.app is run by user manually or by watchdog.exe That is why i am interseted in passing some argument. I don't like creating temorary file idea So Plz if anyone knows about this then plz guide me. I am using folowing code in watchdog.exe to open main application void CCallWatcher::RunMyApp(TDes & appName) { CApaCommandLine * cmd=CApaCommandLine::NewL(); cmd->SetLibraryNameL(appName); cmd->SetCommandL(EApaCommandRun); EikDll::StartAppL(*cmd); } Thanks |
|
Forum posts: 6
void CCallWatcher::RunMyApp(TDes & appName)
{
  CApaCommandLine * cmd=CApaCommandLine::NewLC();Â
  cmd->SetLibraryNameL(appName);   Â
  cmd->SetCommandL(EApaCommandRun);
  _LIT(KString,”String”);
  HBufC* params = KString().AllocL();
  cmd->SetFullCommandLineL(params);
  EikDll::StartAppL(*cmd);Â
  Cleanupstack::PopAndDestroy(cmd);
}
Inside the application you may be able to pick up the string with,
TBuf<20> commandLine;
User::CommandLine(commandLine);
or maybe,
TBuf<20> commandLine;
RProcess().CommandLine(commandLine)
Forum posts: 214
"I only know that I know nothing." (Socrates)
Forum posts: 17
RProcess::SetParameterL
CApaCommandLine::SetProcessEnvironmentL
and to retrieve the parameters from the new process:
User::GetTIntParameter()
User::GetDesParameter()
You can also pass kernel handles into the newly created process, if that's what you want to do.
Forum posts: 15
Im trying to pass arguments between apps using User::CommandLine( buf ) and User::GetDesParameter( buf ), but I did not success. It always returns 'buf' empty.
Any idea?
Thanks