How to pass command line arguments

Login to reply to this topic.
Tue, 2005-08-09 08:47
Joined: 2005-02-12
Forum posts: 98
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

Tue, 2005-08-16 16:06
Joined: 2005-08-02
Forum posts: 6
Re: How to pass command line arguments
Passing a descriptor command line to the application...

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)
Fri, 2006-04-21 14:09
Joined: 2005-02-11
Forum posts: 214
Re: How to pass command line arguments
But how to do it in 9.1? There is no SetFullCommandLineL() method anymore.

"I only know that I know nothing." (Socrates)

Sat, 2006-04-22 23:05
Joined: 2006-04-22
Forum posts: 17
Re: How to pass command line arguments
In 9.1, there is a new mechanism for passing parameters to a process. Have a look at these:

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.
Mon, 2007-05-07 17:47
Joined: 2005-11-29
Forum posts: 15
Re: How to pass command line arguments
Hello.
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
  • Login to reply to this topic.