Discussion Board

Results 1 to 8 of 8
  1. #1
    Registered User
    Join Date
    Jul 2007
    Posts
    279

    application runs more than one time problem??

    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 Moderator
    Join Date
    Mar 2003
    Location
    Lempäälä/Finland
    Posts
    29,185

    Re: application runs more than one time problem??

    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
    Join Date
    Feb 2006
    Location
    Budapest, Hungary
    Posts
    28,809

    Re: application runs more than one time problem??

    You could try putting
    Code:
    if(RProcess::RenameMe(_L("TheOnlyOne"))!=KErrNone)return 0;
    as first line into E32Main.

  4. #4
    Registered User
    Join Date
    Jul 2007
    Posts
    279

    Re: application runs more than one time problem??

    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
    Join Date
    Feb 2006
    Location
    Budapest, Hungary
    Posts
    28,809

    Re: application runs more than one time problem??

    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
    Join Date
    Jul 2007
    Posts
    279

    Re: application runs more than one time problem??

    thanks wizard_hu_ for reply,
    i applied the code but it didn't solve the problem !!!

  7. #7
    Nokia Developer Moderator
    Join Date
    Feb 2006
    Location
    Budapest, Hungary
    Posts
    28,809

    Re: application runs more than one time problem??

    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
    Join Date
    Jul 2007
    Posts
    279

    Re: application runs more than one time problem??

    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, 11: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, 21:27
  4. 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, 21: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
  •  
×