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

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

 2010-02-06 20:55:00 来源:WEB开发网   
核心提示:// why not to demonstrate this either?TBuf<256> cmdLine;RProcess().CommandLine( cmdLine );MainL( cmdLine );// Delete active schedulerCleanupStack::PopAndD

// why not to demonstrate this either?

TBuf<256> cmdLine;

RProcess().CommandLine( cmdLine );

MainL( cmdLine );

// Delete active scheduler

CleanupStack::PopAndDestroy(scheduler);

}

// Global Functions

// 本函数将初始化异常处理栈,创建console对象创建完毕后调用DoStartL,开始进入按键捕获

//捕获完毕后,销毁对象和异常处理栈

GLDEF_C TInt Start()

{

// Create cleanup stack

__UHEAP_MARK;

CTrapCleanup* cleanup = CTrapCleanup::New();

// Create output console

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

if (createError)

return createError;

// Run application code inside TRAP harness, wait keypress when terminated

TRAPD(mainError, DoStartL());

if (mainError)

console->Printf(KTextFailed, mainError);

console->Printf(KTextPressAnyKey);

console->Getch();

delete console;

delete cleanup;

__UHEAP_MARKEND;

return KErrNone;

}

////////////////////////////////////

// CGlobalCapturer

////////////////////////////////////

// Constructor

CGlobalCapturer::CGlobalCapturer() :

CActive( EPriorityNormal )

{

// nothing

}

// Destructor

CGlobalCapturer::~CGlobalCapturer()

{

delete iWindowGroupName;

delete iWindowGroup;

iWsSession.Close();

}

// Cancel listening to key presses

void CGlobalCapturer::DoCancel()

{

iWindowGroup->CancelCaptureKey( iCaptureHandle );

}

// 活动对象的初始化,连接symbian的窗口服务器,创建了一个新的窗口群,并把它的名字设为全局的

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

Tags:Symbian 捕获 全局

编辑录入:coldstar [复制链接] [打 印]
[]
  • 好
  • 好的评价 如果觉得好,就请您
      0%(0)
  • 差
  • 差的评价 如果觉得差,就请您
      0%(0)
赞助商链接