Hello,
i have an server (exe) running in background waiting for events...
i also have a started active scheduler in my exe...
i have 2 questions:
1.) When i stop (kill) the server from within my Application-UI (app) with the following code...
then the destructor of the .exe is not being called!!! (but the exe is stopped, also not showing any mem-leaks on WINS,
but i think there should be some if destructor not called)
void CController::StopServer() {
#ifdef __WINS__
TFindThread finder;
RThread server;
#else
TFindProcess finder;
RProcess server;
#endif
TFullName fullName;
while (finder.Next(fullName) == KErrNone) {
TInt err = fullName.FindF(KServer);
if (err != KErrNotFound) {
TInt procErr = server.Open(finder);
if (procErr == KErrNone) {
server.Kill(KErrNone);
server.Close();
}
}
}
}
...but: when i call CActiveScheduler::Stop() from the exe then the destructor is called.
Can anybody please tell me why the destructor is not called???
Do i have to implement client-server logic for achieving this?
2.) My exe does some drawing on the phone´s idle screen.
When the user switches off the phone the drawing maintains on the screen
till the phone is completely switched off...
I think the destructor is not being called as well...
How can i detect if the phone is being switched off???
i tried it with RSystemAgent: (without success)
User::LeaveIfError(iSysAgent.Connect());
iSysAgentEvent.SetRequestStatus(iStatus);
iSysAgentEvent.SetUid(KUidPhonePwr);
iSysAgent.SetEventBufferEnabled(ETrue);
CActiveScheduler::Add(this);
iSysAgent.NotifyOnEvent(iSysAgentEvent);
SetActive();
and if this event occurs, it should call the observer´s CActiveScheduler::Stop
but it´s not being called...
please can anyone help me...
mike

Reply With Quote


