×

Discussion Board

Results 1 to 7 of 7
  1. #1
    Registered User
    Join Date
    May 2007
    Posts
    48

    two console apps simultanous

    I have a console application that stays in background, I have created an icon in the installed apps list, and I don't want to let the user start two instances of this application how to do that (can I do that?)

    or if I can't do that, can I make GUI application invisible to a user (no icon after using NOKIA button),

    thank you

  2. #2
    Super Contributor
    Join Date
    Nov 2005
    Location
    London
    Posts
    584

    Re: two console apps simultanous

    You could attempt to create a file when the exe starts (in your private directory, say). If it succeeds, continue running, if KErrAlreadyExists is returned, just exit.

    As long as you delete the file again on shutdown, this should work (if a little hacky).

  3. #3
    Nokia Developer Moderator
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    28,689

    Re: two console apps simultanous

    I would rather check TFindProcess or TFindThread in general. If the user simply switches off the phone (or the phone reboots itself for some reason) while your application is running, the file will survive and your program will never start again.
    However you can put the file on the RAM drive (d, which gets re-initialized on every boot.
    Although if you want to rely on KErrAlreadyExists, it is easier to create an RSemaphore or RMutex for example.

  4. #4
    Super Contributor
    Join Date
    Nov 2005
    Location
    London
    Posts
    584

    Re: two console apps simultanous

    You're right, whoops! My solution sucks.

    It should probably be added to a growing list of anti-patterns (more about our collection of patterns/anti-patterns here http://discussion.forum.nokia.com/fo...d.php?t=110695) Thanks!

  5. #5
    Registered User
    Join Date
    May 2007
    Posts
    48

    Re: two console apps simultanous

    thanks, it works, I can now find and shut it down

    now something else

    when I find process it's full name is in format like this:

    Name.exe [Uid] Number_of_instance

    the first instance has number 0001, the second 0002...

    can I get FullName of the proces and then just check if the number at the and is greater then 0001, problem is how to get the name of the process to be sure that it's the name of this process

  6. #6
    Nokia Developer Moderator
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    28,689

    Re: two console apps simultanous

    RProcess has a Name and a FullName (inherited from RHandleBase), you can check them. When you just instantiate an RProcess object, it refers to the current process.

  7. #7
    Registered User
    Join Date
    May 2007
    Posts
    48

    Re: two console apps simultanous

    thanks for help

Similar Threads

  1. Shutting down console apps on S60v2
    By d_wasser in forum Symbian
    Replies: 2
    Last Post: 2007-06-24, 17:23
  2. Replies: 6
    Last Post: 2007-04-18, 11:44
  3. Replies: 5
    Last Post: 2006-10-25, 01:40
  4. set apps to be run background manually
    By Rx-lee in forum Symbian
    Replies: 2
    Last Post: 2004-09-14, 08:58
  5. Error compiling anything other than console apps
    By D_Snake in forum Symbian Tools & SDKs
    Replies: 2
    Last Post: 2003-08-22, 21:12

Posting Permissions

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