H to launch a application with Arguments.
LaunchApplicationWithArgumentL(const TDesC& aExeName, const TDesC8& aArg = KNullDesC8())
    {
    CApaCommandLine* commandLine = CApaCommandLine::NewLC(); 
    commandLine->SetCommandL(EApaCommandRun);
    commandLine->SetExecutableNameL(aExecName);
    commandLine->SetTailEndL(aArg);
    RApaLsSession apaLsSession;
    User::LeaveIfError(apaLsSession.Connect());
    CleanupClosePushL(apaLsSession); 
    User::LeaveIfError(apaLsSession.StartApp(*commandLine));
    CleanupStack::PopAndDestroy();
    CleanupStack::PopAndDestroy(commandLine);
    }
Handle Arguments in UI Application.
Over ride the virtual function ProcessCommandParametersL() of AppUi Class. 3rd parameter of the function aTail contains application parameters
TBool CMySymbianAppUi::ProcessCommandParametersL(TApaCommand aCommand, TFileName &aDocumentName, const TDesC8 &aTail)
{
    iLogger.WriteFormat(_L("ProcessCommandParametersL %d"), aTail.Length());
}

No comments:
Post a Comment