标题
[symbian/uiq] symbian 中捕获键盘输入将其修改为别的键值
clq
浏览(0) +
2008-05-30 14:26:03 发表
编辑
关键字:
[symbian/uiq] symbian 中捕获键盘输入将其修改为别的键值 先在一个构造函数中下一个"钩子": //RWindowGroup::CaptureKey();//截取按键事件 RWindowGroup iWindowGroup=iCoeEnv->RootWin(); //TInt32 iCallBackHandle=iWindowGroup.CaptureKey(EKeyUpArrow, aModifierMask, aModifier); //TInt32 iCallBackHandle=iWindowGroup.CaptureKey(EKeyUpArrow, 0, 0); TInt32 iCallBackHandle=iWindowGroup.CaptureKey(53, 0,0);//数字键5,成功 然后实现一个接口,注意在头文件中要写上它的函数原型,这和一般的 public 事件不同. 注意只能实现在 xxAppUi 这样的类之下才行. //clq add //据说是为了取得 CaptureKey() 函数后的消息 //void CT1AppView::HandleWsEventL(const TWsEvent &aEvent, CCoeControl *aDestination) //void CT1AppUi::HandleWsEventL(const TWsEvent &aEvent, CCoeControl *aDestination) void CT1AppUi::HandleWsEventL(const TWsEvent& aEvent,CCoeControl* aDestination) { //printf("aaa\r\n"); int i = 0; /* //来自 http://developer.uiq.com/forum/click.jspa?searchID=275398&messageID=9766 if (aEvent.Type() == EEventPointer && aDestination->UniqueHandle() == EMyeControl) { aDestination->MakeVisible(EFalse); TRawEvent evt; TPoint p1 = aDestination->Position(); const TPoint &p2 = aEvent.Pointer()->iPosition; evt.Set(TRawEvent::EButton1Down, p1.iX + p2.iX, p1.iY + p2.iY); iEikonEnv->WsSession().SimulateRawEvent(evt); aDestination->MakeVisible(ETrue); } */ //&aEvent.EventData[0]; //TUint8 * code = aEvent.EventData; //替换字符 '5' 为 '6' //if (aEvent.Type() == EEventKey && (int)(aEvent.EventData[0]) == 55) if (aEvent.Type() == EEventKey) { TKeyEvent * pe = aEvent.Key(); if (pe->iCode == 53) { TKeyEvent evt; evt.iCode = '6'; iEikonEnv->WsSession().SimulateKeyEvent(evt); } } //替换字符 '5' 为 向下键 if (aEvent.Type() == EEventKey) { TKeyEvent * pe = aEvent.Key(); if (pe->iCode == 53) { TKeyEvent evt; evt.iCode = EKeyUpArrow; iEikonEnv->WsSession().SimulateKeyEvent(evt); } } CAknAppUi::HandleWsEventL(aEvent, aDestination);//默认处理,不能少 } //clq add _end -------------------------------------------------- 参考了以下资料 http://developer.uiq.com/forum/click.jspa?searchID=275398&messageID=9766 http://developer.uiq.com/forum/click.jspa?searchID=275398&messageID=9321 http://developer.uiq.com/forum/search.jspa?threadID=&q=HandleWsEventL&objID=&dateRange=last90days&userID=&numResults=15&rankBy=10001 http://discussion.forum.nokia.com/forum/showthread.php?t=125923 CaptureKeyUpAndDowns() 索爱上的搜索 http://developer.sonyericsson.com/util/SearchCMS.do?criteria=CaptureKey&x=4&y=5 以及 uiq 和 s60 sdk 的 chm 格式帮助文件.发现即使是开发 uiq 程序也还是看看 s60 的 sdk 帮助有好处. 不过我的 uiq 下, CaptureKey() 的返回值老是负数,根本 hook 不了 :(
clq
28.665 *PlatSec* ERROR - Capability check failed - A Message (function number=0x00000000) from Thread uiq3t1[e65f47b0]0001::uiq3t1, sent to Server !Windowserver, was checked by Thread wserv.exe[10003b20]0001::Wserv and was found to be missing the capabilities: SwEvent . Additional diagnostic message: Capability check failed for RWindowGroup::CaptureKey API -------------------------------------------------- 这是用 Carbide.c++_v1.3.exe 加 uiq 3.0 开发环境下调试时,调试器提示的错误.看来真的是没有签名的原因哦. 这提醒我们,有一个可调试的 IDE 是多么的重要 :)
clq
从 uiq 的文档可知其安全级别为 "Capability: SwEvent".
NEWBT官方QQ群1: 276678893
可求档连环画,漫画;询问文本处理大师等软件使用技巧;求档softhub软件下载及使用技巧.
但不可"开车",严禁国家敏感话题,不可求档涉及版权的文档软件.
验证问题说明申请入群原因即可.