
Originally Posted by
ssn.kishore
Well, I got your problem 100% now. Here is what I would do with my meagre Symbian knowledge.
- Wait for incoming email event
- Open the mail received in the native client
- Capture the screenshot
- Simulate the "Right soft key" so that the client exits
- Wait for a couple of seconds (asynchronously) so that all the processing required to close the client is done by the system
- Open up another email in case there is one
You can see this link for simulation of key events (use procedure 3) and for the scan codes see this.
Kishore,
Thanks a lot for your great job, it worked and now i can close the email client by using the following code.
Code:
TInt CInternetEmailEngine::PeriodicCloseAppTimerCallBack(TAny* aAny)
{
CInternetEmailEngine* self = static_cast<CInternetEmailEngine*>( aAny );
TRawEvent lEventDown;
lEventDown.Set(TRawEvent::EKeyDown, EStdKeyDevice1);
UserSvr::AddEvent(lEventDown);
User::After(2*1000*1000);
// Cancel the timer when the callback should not be called again.
Call: self->iPeriodicCloseAppTimer->Cancel();
return KErrNone; // App closes after returning from here.
}
I used the CPeriodic timer to execute the closing process after some delay.It works well for first two times but when there are more than two mail received then at third chance it fails.
After debugin the code i reliazed that the app crashes after returning from highlighted code.
Actually i am calling this close event like this :
Code:
void CInternetEmailEngine::TakeScreenShot()
{
CInternetEmailAppUi::TakeScreenShot();
iPeriodicCloseAppTimer = CPeriodic::NewL(CActive::EPriorityIdle);
iPeriodicCloseAppTimer->Start((2*1000*1000),(2*1000*1000),TCallBack(PeriodicCloseAppTimerCallBack, this));
}
And the method TakeScreenShot is also called using the Cperiodic Timer.
I fail to understand why the application is crashing.
Please help me.
Thanks in advance.