Discussion Board

Results 1 to 8 of 8
  1. #1
    Registered User ram4soft's Avatar
    Join Date
    Jul 2007
    Posts
    279
    hi
    my application is set to run in background, and the problem is that when i open it manually again from application icon it duplicates it ,ie, it runs it again and i get the actions handled twice
    how can i solve this problem
    thanks

  2. #2
    Nokia Developer Expert symbianyucca's Avatar
    Join Date
    Mar 2003
    Location
    Lempäälä/Finland
    Posts
    28,667
    you should check first that if it is already running before running another instance of it. And if it is GUI application, make sure all base classes are derived from CAkn.. ones, then, the framework will make sure that only one instance is running.

  3. #3
    Nokia Developer Moderator wizard_hu_'s Avatar
    Join Date
    Feb 2006
    Location
    Mallorca, Holiday
    Posts
    27,683
    You could try putting
    Code:
    if(RProcess::RenameMe(_L("TheOnlyOne"))!=KErrNone)return 0;
    as first line into E32Main.

  4. #4
    Registered User ram4soft's Avatar
    Join Date
    Jul 2007
    Posts
    279
    You could try putting
    Code:
    if(RProcess::RenameMe(_L("TheOnlyOne"))!=KErrNone)return 0;
    as first line into E32Main.
    i put it and it idoesn't access "return 0;" do i have to change _L("TheOnlyOne") to anything else??
    thanks

  5. #5
    Nokia Developer Moderator wizard_hu_'s Avatar
    Join Date
    Feb 2006
    Location
    Mallorca, Holiday
    Posts
    27,683
    Apparently that was an optimistic idea.
    You can use the harder way, TFindProcess.
    A possible approach is
    Code:
    GLDEF_C TInt E32Main()
    {
        {
            TFileName filename=RProcess().FileName();
            filename.Delete(0,filename.LocateReverse('\\')+1);
            filename.Append('*');
            TFindProcess fp(filename);
            TFullName fullname;
            fp.Next(fullname);
            if(fp.Next(fullname)==KErrNone)
                return 0;
        }

  6. #6
    Registered User ram4soft's Avatar
    Join Date
    Jul 2007
    Posts
    279
    thanks wizard_hu_ for reply,
    i applied the code but it didn't solve the problem !!!

  7. #7
    Nokia Developer Moderator wizard_hu_'s Avatar
    Join Date
    Feb 2006
    Location
    Mallorca, Holiday
    Posts
    27,683
    I do not know, it works for me - so I created a test code for the RenameMe magic, then it did not work, then added the TFindProcess-stuff, then it worked, then removed the TFindProcess stuff, added the automatic identification of the file name, it still worked, and finally copied the actual result here.

  8. #8
    Registered User ram4soft's Avatar
    Join Date
    Jul 2007
    Posts
    279
    thanks everybody,
    i found that the problem was that i tried to hide the application using this line of code
    CEikonEnv::Static()->RootWin().SetOrdinalPosition( 0,ECoeWinPriorityLow);
    to make it hidden, and when the next time of application opening it opens another thread
    so the solution was to set SetOrdinalPosition(-1)
    thanks

Similar Threads

  1. Replies: 3
    Last Post: 2010-02-05, 10:04
  2. Application runs only one time
    By afka in forum Mobile Java General
    Replies: 2
    Last Post: 2007-04-20, 13:49
  3. Replies: 0
    Last Post: 2005-11-27, 20:27
  4. Application crash problem: runs fine on emulator!
    By Dexterp37 in forum Symbian C++
    Replies: 0
    Last Post: 2005-09-08, 15:04
  5. Embedded application gives panic when runs for the second time
    By hesham.galal in forum Symbian Tools & SDKs
    Replies: 0
    Last Post: 2005-01-02, 20:42

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Nokia Developer aims to help you create apps and publish them so you can connect with users around the world.

京ICP备05048969号  © Copyright Nokia 2013 All rights reserved