×

Discussion Board

Page 1 of 3 123 LastLast
Results 1 to 15 of 31
  1. #1
    Registered User
    Join Date
    Jan 2011
    Posts
    167

    How to stop one application from another?

    Hello friends,


    How to stop or start one application from another if it is already running or not?


    Bheda Dilipsinh

  2. #2
    Nokia Developer Champion
    Join Date
    Dec 2008
    Posts
    2,356

    Re: How to stop one application from another?

    first you need to check whether the app is running or not
    http://wiki.forum.nokia.com/index.ph...w_to_find_them
    Code:
    TBool IsProcessRunning(void)
    	{
    		TBool Ret(EFalse);
    	 
    		TFileName res;
    		TFindProcess find;
    	  	while(find.Next(res) == KErrNone)
    	    {
    	    	RProcess ph;
    		  	ph.Open(res);
    	 
    	
    		  	if(ph.SecureId() == 0x2003CAC6)// SID of the process we are looking for
    		
    		 	{
    		  		Ret = ETrue;
    		  		ph.Close();
    		  		break;
    		  	}
    	 
    		  	ph.Close();
    	    }
    	 
    	    return Ret;
    	}
    after that you can see here http://wiki.forum.nokia.com/index.ph...t_and_stop_exe
    Last edited by somnathbanik; 2011-04-12 at 13:11. Reason: added

  3. #3
    Nokia Developer Champion
    Join Date
    Dec 2008
    Posts
    2,356

    Re: How to stop one application from another?

    to launch app from another app try this
    Code:
    	const TUid KAppUid={0x2003CAC6};
    			_LIT(KDocName,"C:\\Data\\document.txt");
    			TThreadId app_threadid;
    			RApaLsSession ls;
    			User::LeaveIfError(ls.Connect());
    			TInt err=ls.StartDocument(KDocName, KAppUid, app_threadid);
    			ls.Close();

  4. #4
    Registered User
    Join Date
    Jan 2011
    Posts
    167

    Re: How to stop one application from another?

    Quote Originally Posted by somnathbanik View Post
    to launch app from another app try this
    Code:
    	const TUid KAppUid={0x2003CAC6};
    			_LIT(KDocName,"C:\\Data\\document.txt");
    			TThreadId app_threadid;
    			RApaLsSession ls;
    			User::LeaveIfError(ls.Connect());
    			TInt err=ls.StartDocument(KDocName, KAppUid, app_threadid);
    			ls.Close();
    And to stop application?
    -Only way to kill the application?


    bheda dilipsinh
    Last edited by dilipsinh; 2011-04-12 at 13:48.

  5. #5
    Nokia Developer Moderator
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    28,684

    Re: How to stop one application from another?

    The application matters a lot. In case of a GUI app, TApaTask::EndTask results in a standard EEikCmdExit command, and the application can exit normally. It will require PowerMgmt capability.
    Arbitrary processes can be shut down via RProcess::Terminater, Kill, etc. methods. This results in abrupt termination though, applications will not get the chance to save their data. These methods also require PowerMgmt capability.
    If you want to shut down your own code, you can simply have some dedicated IPC feature for handling shutdown requests. Watching for an RProperty can do the job. This variant results in normal exit and does not require any capabilities.

  6. #6
    Nokia Developer Champion
    Join Date
    Dec 2008
    Posts
    2,356

    Re: How to stop one application from another?

    Quote Originally Posted by dilipsinh View Post
    And to stop application?
    -Only way to kill the application?


    bheda dilipsinh
    To stop process you may need to kill according to this thread http://wiki.forum.nokia.com/index.ph...t_and_stop_exe
    Go to the Killing section of the thread, I tried but got some error, as it requirs some capability as wizard_hu_ mentioned.

  7. #7
    Registered User
    Join Date
    Jan 2011
    Posts
    167

    Re: How to stop one application from another?

    I tried to kill my console application from GUI as in thread provided by 'banik', but things are not working. My GUI application crash-down when try to kill Console in my device. But on emulater debug, its working.

    Bheda Dilipsinh

  8. #8
    Registered User
    Join Date
    Jan 2011
    Posts
    167

    Re: How to stop one application from another?

    Wizard, How can i check whether i have the PowerMgmt capability or not?
    or how to get it?


    Bheda Dilipsinh

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

    Re: How to stop one application from another?

    Learn about platform security if you have not done that so far. CAPABILITY is a keyword in the .mmp file, and Carbide.c++ also provides an editor for setting them. But PowerMgmt can not be self-signed, so you will need the free Open Signed Online service as a minimum (http://www.symbiansigned.com)
    Emulator does not enforce capabilities, just provides warnings about them in its logfile (http://wiki.forum.nokia.com/index.php/Epocwind.out)
    There is no crash, there are specific panics (http://wiki.forum.nokia.com/index.ph...ded_panic_code)

  10. #10
    Registered User
    Join Date
    Jan 2011
    Posts
    167

    Re: How to stop one application from another?

    Means i just have to add one word called "PowerMgmt " infront of "CAPABILITY" in .mmp file. And then need to sign it with OpenSignedOnline.




    Bheda Dilipsinh

  11. #11
    Nokia Developer Moderator
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    28,684

    Re: How to stop one application from another?

    Yes, that is the simplest and cheapest approach.

  12. #12
    Registered User
    Join Date
    Jan 2011
    Posts
    167

    Re: How to stop one application from another?

    Quote Originally Posted by wizard_hu_ View Post
    Yes, that is the simplest and cheapest approach.
    Let me try out.

    And

    Thanks wizard and banik.

    Regards
    Bheda Dilipsinh

  13. #13
    Registered User
    Join Date
    Jan 2011
    Posts
    167

    Re: How to stop one application from another?

    "CAPABILITY PowerMgmt"

    After signing with OpenSignedOnline :

    Its working properly.




    Thanks & Regards
    Bheda Dilipsinh

  14. #14
    Registered User
    Join Date
    Jan 2011
    Posts
    167

    Re: How to stop one application from another?

    I have implemented the code provided here on Symbian S60 3rd edition and its working.
    But do this same code will work with S60 2nd edition?
    Because i didnt found the CAPABILITY in the all 2nd edition application's mmp file.

    If "No" then what to do for S60 2nd edition?

    -Bheda Dilipsinh

  15. #15
    Nokia Developer Moderator
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    28,684

    Re: How to stop one application from another?

    On S60 2nd/1st edition there are no capabilities, anyone can do anything. You can try and it is expected to work.

Similar Threads

  1. to call One Application from another
    By dilipsinh in forum Symbian
    Replies: 14
    Last Post: 2011-03-05, 11:02
  2. Replies: 4
    Last Post: 2010-04-06, 15:59
  3. How to use one application to install another one?
    By zs in forum General Development Questions
    Replies: 2
    Last Post: 2010-01-10, 10:52
  4. Replies: 1
    Last Post: 2006-12-16, 00:08
  5. stop an application from inside another application
    By smallfish_ntu in forum Symbian
    Replies: 11
    Last Post: 2003-08-26, 14:06

Posting Permissions

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