×

Discussion Board

Results 1 to 11 of 11
  1. #1
    Super Contributor
    Join Date
    May 2006
    Location
    Beijing,China
    Posts
    1,190

    how to start a console app from a UI app?

    start the console app from the UI app.
    when the UI app is exit or crash, the console is still running.

    how?
    [I][COLOR="Orange"]xhsoldier[/COLOR][/I]
    [email]xhsoldier@gmail.com[/email]/[email]xhsoldier@163.com[/email]

  2. #2
    Super Contributor
    Join Date
    Oct 2005
    Posts
    739

    Re: how to start a console app from a UI app?

    Hi,

    May this code will help you

    Code:
    TBuf<50> KMyAppName = _L("MYEXE.EXE");
    			     
    			     CompleteWithAppPath(KMyAppName);
    			     EikDll::StartExeL(KMyAppName);
    Regards,
    Peter

  3. #3
    Super Contributor
    Join Date
    May 2006
    Location
    Beijing,China
    Posts
    1,190

    Re: how to start a console app from a UI app?

    Quote Originally Posted by peter_k_john View Post
    Hi,

    May this code will help you

    Code:
    TBuf<50> KMyAppName = _L("MYEXE.EXE");
    			     
    			     CompleteWithAppPath(KMyAppName);
    			     EikDll::StartExeL(KMyAppName);
    Regards,
    Peter
    it is discarded in symbian os now.
    [I][COLOR="Orange"]xhsoldier[/COLOR][/I]
    [email]xhsoldier@gmail.com[/email]/[email]xhsoldier@163.com[/email]

  4. #4
    Super Contributor
    Join Date
    Oct 2005
    Posts
    739

    Re: how to start a console app from a UI app?

    Hi

    Any way For 2nd edition the above code works fine for me.

    and for 3rd edition i am using this code

    Code:
    RProcess server;
            server.Create(_L("\\sys\\bin\\myexe.exe"), KNullDesC);		
            server.Resume();
    Regards,
    Peter

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

    Re: how to start a console app from a UI app?

    Code:
    TInt RunExeL( const TDesC& aExeName)
    {
    	TPtrC exePtr;
    	exePtr.Set(aExeName);
    	if (exePtr != KNullDesC())
    	{
    		RApaLsSession apaLsSession;
    		TInt err = apaLsSession.Connect();
    		if (err != KErrNone)
    		{
    			return err;
    		}
    		else
    		{
    			CleanupClosePushL(apaLsSession);  // push apaLsSession
    			CApaCommandLine* cmd = CApaCommandLine::NewLC();  // push cmd
    	
    			cmd->SetExecutableNameL(exePtr);
    			
    			cmd->SetCommandL(EApaCommandOpen);
    			err = apaLsSession.StartApp(*cmd);
    			if (err != KErrNone)
    			{
    				return err
    			}
    			CleanupStack::PopAndDestroy(cmd);  // pop cmd
    			CleanupStack::PopAndDestroy();  // pop apaLsSession
    		}
    	}
    }

  6. #6
    Super Contributor
    Join Date
    May 2006
    Location
    Beijing,China
    Posts
    1,190

    Re: how to start a console app from a UI app?

    it seems that when the ui app exit, the console is exited.
    but I do not want my console exit when ui exit.

    how
    Quote Originally Posted by skumar_rao View Post
    Code:
    TInt RunExeL( const TDesC& aExeName)
    {
    	TPtrC exePtr;
    	exePtr.Set(aExeName);
    	if (exePtr != KNullDesC())
    	{
    		RApaLsSession apaLsSession;
    		TInt err = apaLsSession.Connect();
    		if (err != KErrNone)
    		{
    			return err;
    		}
    		else
    		{
    			CleanupClosePushL(apaLsSession);  // push apaLsSession
    			CApaCommandLine* cmd = CApaCommandLine::NewLC();  // push cmd
    	
    			cmd->SetExecutableNameL(exePtr);
    			
    			cmd->SetCommandL(EApaCommandOpen);
    			err = apaLsSession.StartApp(*cmd);
    			if (err != KErrNone)
    			{
    				return err
    			}
    			CleanupStack::PopAndDestroy(cmd);  // pop cmd
    			CleanupStack::PopAndDestroy();  // pop apaLsSession
    		}
    	}
    }
    [I][COLOR="Orange"]xhsoldier[/COLOR][/I]
    [email]xhsoldier@gmail.com[/email]/[email]xhsoldier@163.com[/email]

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

    Re: how to start a console app from a UI app?

    Did you Tried It must Not Exit.

  8. #8
    Super Contributor
    Join Date
    May 2006
    Location
    Beijing,China
    Posts
    1,190

    Re: how to start a console app from a UI app?

    Quote Originally Posted by skumar_rao View Post
    Did you Tried It must Not Exit.
    trying now, but how about RProcess?
    [I][COLOR="Orange"]xhsoldier[/COLOR][/I]
    [email]xhsoldier@gmail.com[/email]/[email]xhsoldier@163.com[/email]

  9. #9
    Super Contributor
    Join Date
    May 2006
    Location
    Beijing,China
    Posts
    1,190

    Re: how to start a console app from a UI app?

    RApaLsSession aSession;
    aSession.Connect();
    CApaCommandLine* aCmd = CApaCommandLine::NewL();

    aCmd->SetExecutableNameL(_L("S60exe.exe"));
    aCmd->SetCommandL( EApaCommandRunWithoutViews );
    aSession.StartApp(*aCmd);
    /*
    aCmd->SetExecutableNameL(_L("myexe.exe"));
    aCmd->SetCommandL( EApaCommandOpen );
    aSession.StartApp(*aCmd);
    */
    aSession.Close();
    delete aCmd;

    works.
    thanks
    [I][COLOR="Orange"]xhsoldier[/COLOR][/I]
    [email]xhsoldier@gmail.com[/email]/[email]xhsoldier@163.com[/email]

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

    Re: how to start a console app from a UI app?

    Quote Originally Posted by xhsoldier View Post
    trying now, but how about RProcess?
    RProcess Req. All Files Capability.

  11. #11
    Super Contributor
    Join Date
    Oct 2005
    Posts
    739

    Re: how to start a console app from a UI app?

    Quote Originally Posted by skumar_rao View Post
    RProcess Req. All Files Capability.
    Hi,

    It doesn't need any special capability.

    look at this thread for your clarification. http://newlc.com/topic-18599 and more over I have tried that in my application too.

    Regards,
    Peter

Similar Threads

  1. GetErrorText in console app
    By rihoe in forum Symbian
    Replies: 7
    Last Post: 2009-02-05, 11:02
  2. Replies: 2
    Last Post: 2007-04-25, 09:52
  3. exe app to auto start (2ed)
    By shadow-2005 in forum Symbian
    Replies: 4
    Last Post: 2007-03-27, 10:04
  4. symbian signed testing problem.
    By anglina in forum Symbian
    Replies: 0
    Last Post: 2007-02-01, 10:15
  5. Replies: 0
    Last Post: 2006-05-18, 16:56

Posting Permissions

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