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
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
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.
You could try puttingas first line into E32Main.Code:if(RProcess::RenameMe(_L("TheOnlyOne"))!=KErrNone)return 0;
i put it and it idoesn't access "return 0;" do i have to change _L("TheOnlyOne") to anything else??You could try putting
Code:
if(RProcess::RenameMe(_L("TheOnlyOne"))!=KErrNone)return 0;
as first line into E32Main.
thanks
Apparently that was an optimistic idea.
You can use the harder way, TFindProcess.
A possible approach isCode: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; }
thanks wizard_hu_ for reply,
i applied the code but it didn't solve the 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.
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