how to send key event
| Fri, 2005-03-04 08:08 | |
|
hi, i want to send key event from my application for phone application & for calculator, when i go to phone application, it is displaying phone screen with keys on screen. for this application i want to send key event without screen tap. how should i send this event. thanks in advance............ santosh............ PLZ HElP ME..... |
|






Forum posts: 33
Santhosh i am newbie i too searching for the same kind of stuff.., if u got any idea please reply to this.
i am research scholor in IIT Madras, working on distributed speech recognition in symbain based based phones.
here is some related information i found in one thread here in newLC it might be useful to you
I have written a class to post some keyEvents, it has a public method to do it,
now I want to post a string of keys, i.e. 01234567891, the length of this string is 11,
the first ten of digist are posted successfully but the last digit can't be posted without any error,...
I just see 0123456789 on screen, the last digit (1) can't be posted,
Why? is there any buffer?
here is my public method of KeyPoster ActiveObject :
++++++++++++++++++++
void CKeyEventPoster::StartPostingKeyEvents(TUint aCode, TInt aModifier, TInt aRepeat, TInt aScanCode )
{
TWsEvent event;
TInt iForegroundWinGroup = iWsSession.GetFocusWindowGroup();
event.SetType(EEventKeyDown);
event.SetTimeNow();
event.Key()->iCode = aCode;
event.Key()->iModifiers = aModifier;
event.Key()->iRepeats = aRepeat;
event.Key()->iScanCode = aScanCode;
iWsSession.SendEventToWindowGroup(iForegroundWinGroup, event);
event.SetType(EEventKey);
event.SetTimeNow();
event.Key()->iCode = aCode;
event.Key()->iModifiers = aModifier;
event.Key()->iRepeats = aRepeat;
event.Key()->iScanCode = aScanCode;
iWsSession.SendEventToWindowGroup(iForegroundWinGroup, event);
event.SetType(EEventKeyUp);
event.SetTimeNow();
event.Key()->iCode = aCode;
event.Key()->iModifiers = aModifier;
event.Key()->iRepeats = aRepeat;
event.Key()->iScanCode = aScanCode;
iWsSession.SendEventToWindowGroup(iForegroundWinGroup, event);
}
+++++++++++++++
and I call it in this way:
iKeyEventPoster -> StartPostingKeyEvents('0' ,0, 0, EStdKeyNull);
iKeyEventPoster -> StartPostingKeyEvents('1' ,0, 0, EStdKeyNull);
iKeyEventPoster -> StartPostingKeyEvents('2' ,0, 0, EStdKeyNull);
iKeyEventPoster -> StartPostingKeyEvents('3' ,0, 0, EStdKeyNull);
iKeyEventPoster -> StartPostingKeyEvents('4' ,0, 0, EStdKeyNull);
iKeyEventPoster -> StartPostingKeyEvents('5' ,0, 0, EStdKeyNull);
iKeyEventPoster -> StartPostingKeyEvents('6' ,0, 0, EStdKeyNull);
iKeyEventPoster -> StartPostingKeyEvents('7' ,0, 0, EStdKeyNull);
iKeyEventPoster -> StartPostingKeyEvents('8' ,0, 0, EStdKeyNull);
iKeyEventPoster -> StartPostingKeyEvents('9' ,0, 0,
EStdKeyNull);
iKeyEventPoster -> StartPostingKeyEvents('1' ,0, 0,
EStdKeyNull);++++++++++++++++++++
the red line doesn't work,...
Why?
-----------------------------