Discussion Board

Results 1 to 9 of 9

Hybrid View

  1. #1
    Registered User wlbupt's Avatar
    Join Date
    Oct 2004
    Posts
    6
    Hi, I'm try to simulate key press in my application.
    The following is part of my code .

    /**********************/
    void CMyAppkey::SimulateKeyEvent(TInt aCode)
    {
    TKeyEvent aKeyEvent;
    aKeyEvent.iCode = aCode;
    aKeyEvent.iScanCode = 0;
    aKeyEvent.iModifiers = 0;
    aKeyEvent.iRepeats = 0;
    iWsSession.SimulateKeyEvent(aKeyEvent);
    iWsSession.Flush();
    }
    /**********************/

    By testing this, I can simulate all the numeric keys and arrow keys.
    for instance:
    iMyAppkey->SimulateKeyEvent(48);// for number 0
    iMyAppkey->SimulateKeyEvent(63495);// for left arrow key
    iMyAppkey->SimulateKeyEvent(8);// for clear key
    iMyAppkey->SimulateKeyEvent(42);// for star key
    iMyAppkey->SimulateKeyEvent(63557);// for selection key
    iMyAppkey->SimulateKeyEvent(63555);// for right functional key

    but I can not simulate press Application key and End key.
    I tried like this:
    iMyAppkey->SimulateKeyEvent(63570);// for Apps key
    iMyAppkey->SimulateKeyEvent(63587);// for End key

    Besides invoking SimulateKeyEvent(), I also tried the following code:
    /**********************/
    void CMyAppkey::SimulateRawEvent(TInt aScanCode)
    {
    TRawEvent aRawEvent;
    aRawEvent.Set(TRawEvent::EKeyDown,aScanCode);
    iWsSession.SimulateRawEvent(aRawEvent);
    aRawEvent.Set(TRawEvent::EKeyUp,aScanCode);
    iWsSession.SimulateRawEvent(aRawEvent);
    iWsSession.Flush();
    }
    /**********************/

    iMyAppkey->SimulateRawEvent(180);// for Apps key
    iMyAppkey->SimulateRawEvent(197);// for End key

    But it doesn't work either!

    Can anyone help me to fix it?
    thank you.

  2. #2
    Registered User david.caabeiro's Avatar
    Join Date
    Apr 2005
    Location
    Barcelona
    Posts
    1,678
    3rd edition? Do you have the corresponding capability?

  3. #3
    Registered User wlbupt's Avatar
    Join Date
    Oct 2004
    Posts
    6
    I'm on 2.6 and 2.8.
    Now the End key can be simulated .
    But the Apps key is still not work.

  4. #4
    Registered User david.caabeiro's Avatar
    Join Date
    Apr 2005
    Location
    Barcelona
    Posts
    1,678
    Use constants instead of magic numbers (see e32keys.h for instance). App's key code is EKeyApplication0

  5. #5
    Registered User wanglele76's Avatar
    Join Date
    Sep 2007
    Posts
    17
    why when i used the SimulateRawEvent or SimulateKeyEvent method, i got the Panic WSER 66 error? Can you help me ?

  6. #6
    Registered User rajesshwari's Avatar
    Join Date
    Dec 2008
    Posts
    2
    hi all,
    can any one tel me how to simulate the key press events in BREW??
    how to add the key events to the event queue??(i know it is not the right forum to ask about BREW but still im posting). If any one knows brew please let me know the procedure for it.

    Thanks in advance,
    Rajeshwari

  7. #7
    Super Contributor deepchand86's Avatar
    Join Date
    Jul 2008
    Location
    Chennai,India
    Posts
    889

  8. #8
    Nokia Developer Moderator skumar_rao's Avatar
    Join Date
    Mar 2004
    Location
    Singapore
    Posts
    9,968
    ha ha that is not a BREW Programming Site .. that is Drinking Brew Preparation site.
    Last edited by skumar_rao; 2009-01-24 at 07:10.

  9. #9
    Super Contributor deepchand86's Avatar
    Join Date
    Jul 2008
    Location
    Chennai,India
    Posts
    889
    OOps...sorry sorry...
    Juz trusted google search...but it's too intelligent....

Similar Threads

  1. saving game status after press the red end button
    By ayanir in forum Mobile Java General
    Replies: 0
    Last Post: 2006-01-16, 16:07
  2. CloseSTDLIB and emulator waiting for key press
    By domestique in forum Symbian C++
    Replies: 0
    Last Post: 2003-12-23, 21:13

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Nokia Developer aims to help you create apps and publish them so you can connect with users around the world.

京ICP备05048969号  © Copyright Nokia 2013 All rights reserved