×

Discussion Board

Results 1 to 9 of 9
  1. #1
    Registered User
    Join Date
    Mar 2006
    Posts
    5

    CColorConsoleBase not working on device?

    Hi, its my startup learning experiments on console base .exe
    im using CColorConsoleBase instead CConsoleBase as

    LOCAL_D CColorConsoleBase* console;
    and casting the pointer in getting console as

    TRAPD(createError, console = (CColorConsoleBase* ) Console::NewL(KTextConsoleTitle, TSize(KConsFullScreen,KConsFullScreen)));

    and finally in MainL like this


    LOCAL_C void MainL()
    {

    console->Printf(KTextHelloWorld);
    console->Printf(KTextPressAnyKey);
    console->Getch();
    console->ClearScreen();
    console->Getch();

    console->SetPos(0,5);
    console->SetTextAttribute(ETextAttributeHighlight);
    console->Printf(KTextPressAnyKey);

    console->Getch();
    }

    now .exe is running well on emulater with Highlighted text for last printf but the same .exe on device(6630) exits just after 'SetPos' function call.
    Can any one suggest me what is wrong and how to write correct code for desired result on device?

  2. #2
    Registered User
    Join Date
    Mar 2006
    Posts
    5

    Unhappy Re: CColorConsoleBase not working on device?

    No reply? Is it so easy , not to reply?
    Help where r NFCs ?

  3. #3
    Nokia Developer Champion
    Join Date
    Jul 2004
    Posts
    2,015

    Re: CColorConsoleBase not working on device?

    Well I don't know but something to look at is Console::NewL

    What class is this you are calling, I'll bet its CConsoleBase::NewL(), so how on earth does casting it to a CColorConsoleBase* after its been created actually turn it into a CColorConsoleBase object huh?

    If you just get rid of the cast and declare console as a CConsoleBase does it work then?

  4. #4
    Registered User
    Join Date
    Mar 2006
    Posts
    5

    Re: CColorConsoleBase not working on device?

    my frnd it is Console::NewL() (see e32base.h) for getting the CConsoleBase* type. CColorConsoleBase is derived from CConsoleBase, with a virtual function SetTextAttribute (see e32cons.h) perhaps for text attribute of console.
    Being derived from CConsoleBase, pointer casting is not wrong(i think so, because desired result are visible on emulator) , a well known C++ feature( also Symbian C++ ??).

  5. #5
    Nokia Developer Champion
    Join Date
    Jul 2004
    Posts
    2,015

    Re: CColorConsoleBase not working on device?

    My point is if its creating a CConsoleBase then casting that to a CColorConsoleBase which is derviced from CConsoleBase most definatly is wrong and certianly not a well known C++ feature.

    What if a CConsoleBase object is 4 bytes large and a CColorConsoleBase is a million bytes large,

    if you do this

    CColorConsoleBase* base = (CColorConsoleBase*) CConsoleBase::NewL().

    Does the cast magically allocate an additional 9999996 bytes? I think not.
    Last edited by hotcheese; 2006-03-28 at 21:51.

  6. #6
    Registered User
    Join Date
    Mar 2006
    Posts
    5

    Re: CColorConsoleBase not working on device?

    then what goes wrong for device, even build is successful? app is running on emulator with changed text attribute.

  7. #7
    Nokia Developer Champion
    Join Date
    Jul 2004
    Posts
    2,015

    Re: CColorConsoleBase not working on device?

    because the device is more strict, something which is faulty might actually work on the emulator. A typical example is exceptions caused by null or invalid pointers, on the emulator sometimes these will succeed but they won't on the hardware.

    With this example you may just be being lucky with the emulator and the hardware is reflecting the actual situation.

    I'm not saying it is the cause of your problem but that cast definatly is wrong anyway regardless of if its the cause or not.

  8. #8
    Registered User
    Join Date
    Mar 2006
    Posts
    5

    Re: CColorConsoleBase not working on device?

    ok, i understand your point, but then where r the forum nokia champian to give right coding for displaying highlighted text on device using CColorConsoleBase class(or any other way) for console base .exe ???

  9. #9
    Nokia Developer Champion
    Join Date
    Jul 2004
    Posts
    2,015

    Re: CColorConsoleBase not working on device?

    There's a few people from Nokia who answer questions on this site but looks to me like they do it in a personal capacity (i.e. in their own time). I don't think there is somebody who's responsibility it is to answer people's questions, does it state anywhere that there is such a person?

Similar Threads

  1. Bluetooth Security: What exactly is an untrusted device?
    By rahulmcs in forum Bluetooth Technology
    Replies: 1
    Last Post: 2005-12-02, 06:26
  2. Replies: 0
    Last Post: 2005-10-13, 05:17
  3. KEY_POUND and KEY_STAR not working on series 60 device or emulator
    By r0bby in forum Mobile Java Tools & SDKs
    Replies: 3
    Last Post: 2005-07-06, 13:24
  4. Working fine on emulator but not on Device
    By gaurav17281 in forum Mobile Java General
    Replies: 3
    Last Post: 2003-07-24, 19:14

Posting Permissions

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