×

Discussion Board

Results 1 to 12 of 12
  1. #1
    Regular Contributor
    Join Date
    Dec 2008
    Posts
    129

    Smile How to launch console exe from GUI application in S60 3rd fp2?

    Hi
    I'm using S60 3rd FP2.
    In my application, I run a background exe and launch my main application at specified event and exits the background exe using User::Exit(KErrNone);. I am able to achieve this.
    But when I try to launch that console exe once again from my main application. This exe does not get launched. Because appSession.GetAppInfo(appInfo, uid) gives the value KErrNotFound.
    Can u please suggest me where I am wrong?

  2. #2
    Super Contributor
    Join Date
    Mar 2004
    Location
    Singapore
    Posts
    9,968

    Re: How to launch console exe from GUI application in S60 3rd fp2?

    Quote Originally Posted by NRK View Post
    Hi
    I'm using S60 3rd FP2.
    In my application, I run a background exe and launch my main application at specified event and exits the background exe using User::Exit(KErrNone);. I am able to achieve this.
    But when I try to launch that console exe once again from my main application. This exe does not get launched. Because appSession.GetAppInfo(appInfo, uid) gives the value KErrNotFound.
    Can u please suggest me where I am wrong?
    I suggest not to exit the console application and on event try checking if your main application still running or not.

  3. #3
    Regular Contributor
    Join Date
    Dec 2008
    Posts
    129

    Smile Re: How to launch console exe from GUI application in S60 3rd fp2?

    Thanks skumar_rao,
    But I have requirement like this.
    If I launch my main application, the background exe should be closed.
    And when I exit from my main application, the background exe should run in background.

    So Is there any solution for launching of exe from my main application?

  4. #4
    Super Contributor
    Join Date
    Mar 2004
    Location
    Singapore
    Posts
    9,968

    Re: How to launch console exe from GUI application in S60 3rd fp2?

    Quote Originally Posted by NRK View Post
    Thanks skumar_rao,
    But I have requirement like this.
    If I launch my main application, the background exe should be closed.
    And when I exit from my main application, the background exe should run in background.

    So Is there any solution for launching of exe from my main application?
    can you show us how you are trying to launch the console. also match your code with wiki code.

  5. #5
    Regular Contributor
    Join Date
    Dec 2008
    Posts
    129

    Smile Re: How to launch console exe from GUI application in S60 3rd fp2?

    RWsSession wsSession;
    User::LeaveIfError( wsSession.Connect() );
    CleanupClosePushL(wsSession); //pop n Destroy

    if(!IsCalAlarmObserverAppRuning()) // already running
    {
    RApaLsSession appSession;
    TInt err = appSession.Connect();
    if(err!=KErrNone)
    {
    return;
    }
    err = appSession.GetAllApps();
    if(err!=KErrNone)
    {
    return;
    }


    TApaAppInfo appInfo;
    TInt result = KErrNone;
    TBuf<KMaxFullName> appName;

    while(! appSession.GetNextApp( appInfo ))
    {
    if( appInfo.iUid == KUidToLaunch ) //Multiview application
    {
    // Found the app we we're looking for.
    appName.Copy(appInfo.iFullName);
    result = RApaLsSession::ENoMoreAppsInList;
    break;
    }
    }

    CApaCommandLine* commandLine = CApaCommandLine::NewLC();
    commandLine->SetExecutableNameL(appName);
    commandLine->SetCommandL(EApaCommandRun);
    commandLine->SetDocumentNameL (KNullDesC());
    commandLine->SetTailEndL(KNullDesC8());
    appSession.StartApp(*commandLine);
    appSession.Close();
    CleanupStack::PopAndDestroy(commandLine);
    }
    CleanupStack::PopAndDestroy(); //wsSession



    Using the same code I was able to launch my main application from console background exe.

  6. #6
    Super Contributor
    Join Date
    Mar 2004
    Location
    Singapore
    Posts
    9,968

    Re: How to launch console exe from GUI application in S60 3rd fp2?

    Code:
    LaunchApplicationL(const TDesC& aConsoleName, const TDesC8& aParam)
        {
        CApaCommandLine* cmdLine = CApaCommandLine::NewLC();
        cmdLine->SetCommandL(EApaCommandRun);
        cmdLine->SetExecutableNameL(aConsoleName);
        cmdLine->SetTailEndL(aParam);
        RApaLsSession apals;
        User::LeaveIfError(apals.Connect());
        CleanupClosePushL(apals);
        User::LeaveIfError(apals.StartApp(*cmdLine));
        CleanupStack::PopAndDestroy(); 
        CleanupStack::PopAndDestroy(cmdLine);
        }

  7. #7
    Regular Contributor
    Join Date
    Dec 2008
    Posts
    129

    Re: How to launch console exe from GUI application in S60 3rd fp2?

    Thanks skumar_rao for the code.
    I tried ur code and exe gets launched when I pass the name of exe explicitly.
    But problem is that I am getting is:

    while(! appSession.GetNextApp( appInfo ))
    {
    if( appInfo.iUid == KUidToLaunch ) //Multiview application
    {
    // Found the app we we're looking for.
    appName.Copy(appInfo.iFullName);
    result = RApaLsSession::ENoMoreAppsInList;
    break;
    }
    }

    this code is not able to find the app with this UId (KUidToLaunch )
    I want to get the name of exe by comaparing the UID.

    Thanks

  8. #8
    Super Contributor
    Join Date
    Mar 2004
    Location
    Singapore
    Posts
    9,968

    Re: How to launch console exe from GUI application in S60 3rd fp2?

    Quote Originally Posted by NRK View Post
    I want to get the name of exe by comaparing the UID.

    Thanks
    If you still want to use the UID then
    Code:
        RApaLsSession apaLsSession;
        apaLsSession.Connect();
        User::LeaveIfError(apaLsSession.GetAllApps());
        TApaAppInfo appInfo;
        TInt retval = apaLsSession.GetAppInfo(appInfo, KUidToLaunch );
        apaLsSession.Close();
    
         // appInfo.iFullName //you got the name.

  9. #9
    Nokia Developer Moderator
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    28,751

    Re: How to launch console exe from GUI application in S60 3rd fp2?

    You can also try a simple RProcess::Create, Resume, Close.
    Note that RProcess::Create does not like x:\sys\bin, and TApaAppInfo::iFullName may contain drive and path - remove them in this case (TParse or simple descriptor operations can help you in that).

  10. #10
    Regular Contributor
    Join Date
    Dec 2008
    Posts
    129

    Re: How to launch console exe from GUI application in S60 3rd fp2?

    Thanks skumar_rao,
    I used ur code. But following statement returns -1 KErrNotFound.

    TInt retval = apaLsSession.GetAppInfo(appInfo, KUidToLaunch );

  11. #11
    Regular Contributor
    Join Date
    Dec 2008
    Posts
    129

    Re: How to launch console exe from GUI application in S60 3rd fp2?

    Whether GetAllApps() gets the console exe?

  12. #12
    Nokia Developer Moderator
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    28,751

    Re: How to launch console exe from GUI application in S60 3rd fp2?

    Feel free to test it. And when you are doing that you can also check what TApaAppInfo::iFullName actually contains.

Similar Threads

  1. LAC on S60 3rd Ed FP2
    By overlaymedia in forum Mobile Java General
    Replies: 10
    Last Post: 2010-07-29, 13:40
  2. Using pipes in S60 GUI application
    By darqan in forum Open C/C++
    Replies: 2
    Last Post: 2008-10-24, 13:56
  3. Can Nokia connectivity Framwork work with S60 3rd FP2 SDK?
    By luckyapplehead in forum Symbian Networking & Messaging (Closed)
    Replies: 2
    Last Post: 2007-12-18, 12:52
  4. Application crashes by soft key press in landscape mode in S60 3rd ed FP1 emulator
    By retset in forum Mobile Java Media (Graphics & Sounds)
    Replies: 5
    Last Post: 2007-11-08, 16:05
  5. Will S60 3rd Ed FP2 emulator have Support for Windows Vista Aero
    By jimgilmour1 in forum Symbian Tools & SDKs
    Replies: 5
    Last Post: 2007-10-17, 19:39

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×