WEB开发网
开发学院手机开发Symbian 开发 Symbian捕获全局按键的解决方案 阅读

Symbian捕获全局按键的解决方案

 2010-02-06 20:55:00 来源:WEB开发网   
核心提示:class CApaWindowGroupName;// 该类是通过活动对象来处理键盘事件class CGlobalCapturer : public CActive{public:// New functionsvoid StartCapturingL();~CGlobalCapturer();CGlobalCapt

class CApaWindowGroupName;

// 该类是通过活动对象来处理键盘事件

class CGlobalCapturer : public CActive

{

public:

// New functions

void StartCapturingL();

~CGlobalCapturer();

CGlobalCapturer();

public:

// From CActive

void RunL();

protected:

virtual void DoCancel();

private:

// Data

// Session to the window server

// 用它来连接窗口服务器

RWsSession iWsSession;

// Window group created to listed to the events

// 用它来获取按键事件

RWindowGroup* iWindowGroup;

// Is used to hide window from the task switcher

// 这个就是用来在任务切换器中隐藏当前窗口的地方了

CApaWindowGroupName* iWindowGroupName;

// Handle to the capturing request

TInt32 iCaptureHandle;

// Number of keypresses already captured

TInt iCaptureCounter;

};

// Function Prototypes

#ifdef __WINS__

IMPORT_C TInt WinsMain(TAny* aParam);

#else

GLDEF_C TInt E32Main();

#endif

#endif // __GLOBALKEYCAPTURE_H__

这里是global key capture的源文件中定义的内容了

// Include Files

#include "GlobalKeyCapture.h"

#include

#include

#include // Console 完全是为了显示方便,其实不用它也可以利用文件之类的手段做到

#include // CApaWindowGroupName

// Constants

// Text strings created by wizard

_LIT( KTextConsoleTitle, "Console" );

_LIT( KTextFailed, " failed, leave code = %d" );

_LIT( KTextPressAnyKey, " [press any key to exit] " );

// Key to listen to

上一页  1 2 3 4 5 6  下一页

Tags:Symbian 捕获 全局

编辑录入:coldstar [复制链接] [打 印]
赞助商链接