×

Discussion Board

Results 1 to 4 of 4
  1. #1
    Registered User
    Join Date
    Mar 2003
    Posts
    15

    error C2352: 'CCoeAppUi::ActivateViewL' : illegal call of non-static member function

    Hi all,

    I'm trying to launch an application using ActivateViewL in the 'EXPORT_C CApaApplication* NewApplication()' section of the MyView example (Myviewapp.cpp).

    At first, I got an "undefined error" for ActivateViewL, but I fixed that by adding "CEikAppUi::" before the ActivateViewL statement. Now, however, I get the following error:

    'error C2352: 'CCoeAppUi::ActivateViewL' : illegal call of non-static member function' - but I don't know why.

    My code is as follows:

    EXPORT_C CApaApplication* NewApplication()
    {
    const TUid KToDoUid = { 0x10005900 };
    const TUid KToDoViewId = { 1 };
    CEikAppUi::ActivateViewL(TVwsViewId(KToDoUid, KToDoViewId));
    User::Exit(0);
    return 0;
    }


    The code works fine if placed in the Myviewappui.cpp file, however I require it in the Myviewapp.cpp file.

    Any ideas anyone?

    Many thanks for reading, and any input is greatly appreciated.
    Last edited by j2k; 2004-01-28 at 12:47.

  2. #2
    Registered User
    Join Date
    May 2003
    Location
    London
    Posts
    40
    you cant call it like that. Your trying to call a non-static functions as if its a static function. A static function is a function you can call without creating the object, a non-static function needs the object to be created first.

    You can't return a 0 from NewApplication, you need to to create the app and return a pointer to it. The symbian framework takes it from there, and calls your pointer. In NewApplication() you can't really do much as your application isn't created yet (UI wise, which includes the view arch). Most applications consist of a really small NewApplication(). Here is what it usually is.

    Code:
    EXPORT_C CApaApplication* NewApplication()
    {
        return new Myviewapp;
    }
    The symbian framework takes this and calls CreateDocumentL() from this pointer, which should return a pointer to the newly created document object, which in turns calls the CreateAppUiL() creating your base symbian framework.

    Now there should be no reason you require your code in the NewApplication() function, if you want your code to do something at startup, put it in the ConstructL function of your MyviewappUI section.

  3. #3
    Registered User
    Join Date
    Mar 2003
    Posts
    15
    Thanks but I have a reason for needing it in NewApplication - this allows me to not require any code in any of the other source files, and creates really small files (<1kb). It works fine when using Eikdll::StartAppL so thought the same would apply for ActivateViewL.

    The User::Exit(0) exits the application so the fact it's returning 0 does not cause any problems.

  4. #4
    Registered User
    Join Date
    May 2003
    Location
    London
    Posts
    40
    oooooookay

    you will not be able to call ActivateViewL until you create an instance of the object CEikAppUi, or an instance of an object inherited from CEikAppUi. AFAIK there is not static ActivateViewL method. Read up a book on object orientated programming, specifically the parts that mention static functions on objects.

    Anyhow, waiting till an CEikAppUi type object is created won't use that much memory as symbian normally uses shared libraries. Plus also your killing it as soon as you start just after u activate another view.

Posting Permissions

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