Why sending message to another app get failed after calling RApaLsSession::StartApp()?
| Mon, 2008-04-21 10:04 | |
TApaTaskList taskList(CCoeEnv::Static()->WsSession());After the last line, I called "task.SendMessage(msgUid, msgBody);" and get error code -1, and I checked task and found the window group id value is -1. I got confused. What the hell has the "StartApp()" done? Why didn't my webApp start up at once? What should I do if I want to start a new application and send another message at once? That means I need get the result by call SetCommandL() first. |
|






Forum posts: 9
Is there anybody could give me an answer?
Forum posts: 672
Calling StartApp starts the application (I assume you have this checked), but of course this doesn't happen immediately. The launching takes time, you are in a multiprocessing enviroment so the turn to execute can be given also to other threads while your app and the app you launched is being started up. You just cannot assume that the application is there immediately ready to receive your messages.
If the other application is also yours, you could use a Semaphore to wait for the application to signal it is ready to roll. If this is not your app that you are launching, you could use a timer to wait for a reasonable amount of time and then try. If this fails, try again after a while.
Forum posts: 9
Thank you for your reply. I have resolved this problem. As you said, I sent a message to another app with a timer calling back that in the other thread. But if I just wait after StartApp(), I will get failed no matter how long i would wait. I think that may be involved in something about thread switching. But I don't know what exactly happened.