×

Discussion Board

Results 1 to 14 of 14
  1. #1
    Super Contributor
    Join Date
    Jul 2006
    Posts
    585

    How to use CActiveScheduler in console application

    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?
    开放,分享,互助

  2. #2
    Super Contributor
    Join Date
    Jun 2006
    Location
    India
    Posts
    3,037

    Re: How to use CActiveScheduler in console application

    Hi,

    CActiveScheduler* scheduler = new (ELeave) CActiveScheduler();
    CleanupStack::PushL(scheduler);
    CActiveScheduler::Install(scheduler);

    //asynchronous request

    CActiveScheduler::Start();
    CleanupStack::PopAndDestroy(scheduler);
    Use [URL="http://qt.nokia.com/products/qt-quick/"]Qt-Quick[/URL] to make your application UI more attractive.

    [URL="http://store.ovi.com/content/271896"]http://store.ovi.com/content/271896[/URL] | [URL="http://store.ovi.com/content/276199"]http://store.ovi.com/content/276199[/URL] |[URL="http://store.ovi.com/content/276202"] http://store.ovi.com/content/276202[/URL] | [URL="http://store.ovi.com/content/280827"]http://store.ovi.com/content/280827[/URL]

  3. #3
    Super Contributor
    Join Date
    Mar 2004
    Location
    Czech Republic
    Posts
    2,037

    Re: How to use CActiveScheduler in console application

    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

  4. #4
    Super Contributor
    Join Date
    Jul 2006
    Posts
    585

    Re: How to use CActiveScheduler in console application

    Quote Originally Posted by kkrish View Post
    Hi,

    CActiveScheduler* scheduler = new (ELeave) CActiveScheduler();
    CleanupStack::PushL(scheduler);
    CActiveScheduler::Install(scheduler);

    //asynchronous request

    CActiveScheduler::Start();
    CleanupStack::PopAndDestroy(scheduler);
    Thanks for your reply,the codes you post can be userful when CONE is not created,but it will crash when you have already created a CONE,because the CONE has create and install a active scheduler for you.



    Regards,
    Utopia2006
    开放,分享,互助

  5. #5
    Super Contributor
    Join Date
    Jul 2006
    Posts
    585

    Re: How to use CActiveScheduler in console application

    Quote Originally Posted by stenlik View Post
    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,your link is useful for me ,but i still do not know how to solve the problem i encounted.
    what is the meaning of nest active scheduler? is there any example codes for me ? Thanks!


    Regards,
    Utopia2006
    开放,分享,互助

  6. #6
    Super Contributor
    Join Date
    Mar 2004
    Location
    Czech Republic
    Posts
    2,037

    Re: How to use CActiveScheduler in console application

    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

  7. #7
    Super Contributor
    Join Date
    Jul 2006
    Posts
    585

    Re: How to use CActiveScheduler in console application

    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.
    开放,分享,互助

  8. #8
    Super Contributor
    Join Date
    Mar 2004
    Location
    Czech Republic
    Posts
    2,037

    Re: How to use CActiveScheduler in console application

    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

  9. #9
    Super Contributor
    Join Date
    Jul 2006
    Posts
    585

    Re: How to use CActiveScheduler in console application

    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.
    开放,分享,互助

  10. #10
    Registered User
    Join Date
    Jul 2008
    Posts
    275

    Re: How to use CActiveScheduler in console application

    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 ??

  11. #11
    Super Contributor
    Join Date
    Jul 2006
    Posts
    585

    Re: How to use CActiveScheduler in console application

    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?
    开放,分享,互助

  12. #12
    Registered User
    Join Date
    Jul 2008
    Posts
    275

    Re: How to use CActiveScheduler in console application

    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.

  13. #13
    Nokia Developer Moderator
    Join Date
    Feb 2006
    Location
    Budapest, Hungary
    Posts
    28,752

    Re: How to use CActiveScheduler in console application

    Strange, a "delete env" used to be enough
    Code:
        CEikonEnv *env=new(ELeave)CEikonEnv;
        TRAPD(err,
            env->ConstructL();
            ui=new(ELeave)CAppUi;
            ui->ConstructL();
            );
        if(err==KErrNone)
            env->ExecuteD();
        else
            delete env;
    At least this piece of code has worked for me in 2005.

  14. #14
    Registered User
    Join Date
    Jul 2008
    Posts
    275

    Re: How to use CActiveScheduler in console application

    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);
    }

Similar Threads

  1. Change font of the console application
    By asheeshv in forum Symbian
    Replies: 3
    Last Post: 2009-06-15, 12:23
  2. Console Application Exits In Emulator
    By ptilghman in forum Open C/C++
    Replies: 1
    Last Post: 2008-05-19, 20:49
  3. Please help.. regarding simple hellotext console application
    By sajidraheemsheikh in forum Carbide.c++ IDE and plug-ins (Closed)
    Replies: 1
    Last Post: 2008-03-05, 17:02
  4. console application 3rd ed. on target
    By sym_starter in forum Symbian
    Replies: 5
    Last Post: 2006-10-11, 16:13
  5. Replies: 3
    Last Post: 2006-08-17, 10:48

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×