My console application create a CONE,when some event happens i use the CONE to display a control,but when i call CActiveScheduler::Start(), the console application crash!How can i use CActiveScheduler in console application when i create a CONE?
My console application create a CONE,when some event happens i use the CONE to display a control,but when i call CActiveScheduler::Start(), the console application crash!How can i use CActiveScheduler in console application when i create a CONE?
开放,分享,互助
Hi,
CActiveScheduler* scheduler = new (ELeave) CActiveScheduler();
CleanupStack::PushL(scheduler);
CActiveScheduler::Install(scheduler);
//asynchronous request
CActiveScheduler::Start();
CleanupStack::PopAndDestroy(scheduler);
Use Qt-Quick to make your application UI more attractive.
http://store.ovi.com/content/271896 | http://store.ovi.com/content/276199 | http://store.ovi.com/content/276202 | http://store.ovi.com/content/280827
Hi,
it is because Control Environment implements the active scheduler and you are instaling another scheduler in the same thread. System raises the panic 43 if if there is already an installed active scheduler.
Anyway you can nest active schedulers, if this is what you want to do (http://wiki.forum.nokia.com/index.php/Active_Scheduler).
BR
STeN
Hi,
you do not need creating the new active scheduler, rely on the AS which comes from CONE. You also hghly proabably do not need to use nested AS.
There are some links:
http://joakimandersson.se/archives/2...ve-schedulers/
http://www3.symbian.com/faq.nsf/0/D5...B?OpenDocument
BR
STeN
yes, i do not need creating the new active scheduler.As you suggest, i also do not need to use nested AS,then how can i solve my problem now? I need CONE in the cosole application ,and also need to use the AS to monitor some event continuely.
开放,分享,互助
Hi,
with CONE you already have Active Scheduler - you do not need to care about it. You can start using active object immediatelly.
BTW - Why you need CONE in console application??
BR
STeN
hi,The reason why i create CONE in the console application is that i need to play a gif picture when i catch some event.
开放,分享,互助
Hi,utopia2006,you guy post thread here and there, thread by thread.........
LOCAL_C void MainL()
{
CEikonEnv* env = CEikonEnv::Static();
env->SetSystem(ETrue);
env->RootWin().SetOrdinalPosition(0, ECoeWinPriorityNeverAtFront);
CFakeAppUi* appUi = new(ELeave)CFakeAppUi();
CleanupStack::PushL(appUi);
appUi->ConstructL(); //NOTE HERE!!! you should make your instances of AOs be members of APPUI
CleanupStack::Pop(appUi);
env->SetAppUi(appUi);
}
// Global Functions
GLDEF_C TInt E32Main()
{
CEikonEnv* env = new CEikonEnv;
TRAPD(err, env->ConstructL());
__ASSERT_ALWAYS(!err, User::Panic(_L("EXECTRL"), err));
TRAPD(err1,MainL());
if(err1 == KErrNone) env->ExecuteD();
return 0;
}
---------------------------------
NOTE:!!!!! the sample code cost me many days ,but there's still problems----if Appui->ConstructL() leaves,I have no idea to deal with the situation. any idea ??
hi,BabyKiller,i also encounted the problem as you mentiond .I want to know how do you define your appui class ,can you paste the code here?
开放,分享,互助
class CFakeAppUi: public CEikAppUi
It works fine as my AOs constrct successfully.
But when I call User::Leave() in CFakeAppUi::ConstrctL() to simulate the error case,I don't know how to deal with CEikonEnv.
if a Leave occurs,it is obviously that we dont need to call CEikonEnv::ExcuteD(),but after constrcting the CEikonEnv,it seems that any manipulation to CONE (such as delete env or env->DestroyEnvironment()...)will raise error.
Strange, a "delete env" used to be enoughAt least this piece of code has worked for me in 2005.Code:CEikonEnv *env=new(ELeave)CEikonEnv; TRAPD(err, env->ConstructL(); ui=new(ELeave)CAppUi; ui->ConstructL(); ); if(err==KErrNone) env->ExecuteD(); else delete env;
Hi,Wizard
CEikonEnv *env=new(ELeave)CEikonEnv;
TRAPD(err,
env->ConstructL();
ui=new(ELeave)CAppUi;
ui->ConstructL();//if here Leaves,err != KErrNone
);
if(err==KErrNone)
env->ExecuteD();
else
delete env;//here raises a Panic CONE 28
Wizard,you can test like this:
void AppUi::ConstructL()
{
BaseConstructL(ENoAppResourceFile | ENoScreenFurniture);
User::Leave(KErrCancel);
}