×

Discussion Board

Results 1 to 3 of 3
  1. #1
    Regular Contributor
    Join Date
    Jan 2007
    Posts
    80

    Red face EXE programming : should i use thread ?

    Hi Champions,

    Looking at some EXE examples(graphics in EXE for example), i wondered some things before beginning writing EXE :

    While GUI applications needs Exit() to finish executing because they runs in a thread (right?), EXE, when executed, run from the E32Main() and die when they exits the "Main" : in the example above, the EXE draw rectangles on screen before exiting (right?)

    How could it be possible to not die ? For example, to react to some events : i've an incoming call observer (CIncomingCallObserver) code working very well under GUI application, but i don't know how to deal within an EXE...

    Should i instantiate an Active object before exiting the main in order to stay alive ?

    Please post detailled answer since i'm very newbie

  2. #2
    Nokia Developer Moderator
    Join Date
    Feb 2006
    Location
    Budapest, Hungary
    Posts
    28,572

    Re: EXE programming : should i use thread ?

    Sorry, no detailed answer.
    In short: any approach you choose you will definitely need to get notifications from the Windowing Server ("redraw", "keypress occured", etc.). You also want to observe incoming calls. Every callback-like functionality originating from some server (like Windowing or Telephony Servers) requires you to have an active scheduler. And when you Start() CActiveScheduler, it will actually start to wait. In practice a CActiveScheduler::Start() is the main loop of every "interactive" (GUI or server) Symbian application. Start() is inherently invoked in case of GUI apps just after instantiating the AppUi class, and you can also call it from your executable:
    Code:
    GLDEF_C TInt E32Main()
    {
        CTrapCleanup* cleanup=CTrapCleanup::New();
        TRAPD(error,MainL());
        delete cleanup;
        return 0;
    }
    
    LOCAL_C void MainL(void)
    {
        CActiveScheduler *scheduler=new(ELeave)CActiveScheduler;
        CleanupStack::PushL(scheduler);
        CActiveScheduler::Install(scheduler);
    
        <You can create your active objects here and make them to wait for something>
    
        CActiveSheduler::Start();
    
        CActiveScheduler::Install(NULL);
        CleanupStack::PopAndDestroy(); // scheduler
    }
    CActiveScheduler::Start() will not return until you invoke CActiveScheduler::Stop() somewhere. Thus it is important to wait for something before invoking Start().

  3. #3
    Regular Contributor
    Join Date
    Jan 2007
    Posts
    80

    Thumbs up Re: EXE programming : should i use thread ?

    Waow, thank you for answer, it's more clear for me (and it's enough detailled!).

    Thank you, very usefull answer. You rock !

Similar Threads

  1. S60 SDK 3rd edition FP1 Emulator problem
    By justteam in forum Symbian Tools & SDKs
    Replies: 14
    Last Post: 2010-03-23, 08:47
  2. console app running problem
    By xcompass in forum Symbian
    Replies: 3
    Last Post: 2009-05-08, 13:26
  3. Active objects in EXE second thread
    By inguvaseshu in forum Symbian Networking & Messaging (Closed)
    Replies: 8
    Last Post: 2006-08-10, 05:35
  4. Replies: 10
    Last Post: 2006-02-28, 13:05
  5. Link errors when trying to Display bitmap
    By Bkc82 in forum Symbian Media (Closed)
    Replies: 1
    Last Post: 2006-01-16, 22:46

Posting Permissions

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