⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 mguardkeycapture.cpp,v

📁 symbian s60手机上的短信拦截源代码。
💻 CPP,V
📖 第 1 页 / 共 2 页
字号:
head	1.3;access;symbols	arelease:1.1.1.1	avendor:1.1.1;locks; strict;comment	@// @;1.3date	2007.08.22.11.15.36;	author administrator;	state Exp;branches;next	1.2;deltatype	text;permissions	644;commitid	86846cc1ad73368;kopt	kv;filename	@MGuardKeyCapture.cpp@;1.2date	2007.07.30.13.21.39;	author administrator;	state Exp;branches;next	1.1;deltatype	text;permissions	644;commitid	17046ade5e20ed2;kopt	kv;filename	@MGuardKeyCapture.cpp@;1.1date	2007.07.24.10.59.30;	author administrator;	state Exp;branches	1.1.1.1;next	;deltatype	text;permissions	644;1.1.1.1date	2007.07.24.10.59.30;	author administrator;	state Exp;branches;next	;deltatype	text;permissions	644;desc@@1.3log@capture left arrow key only@text@/** ============================================================================*  Name     :  MGuardKeyCapture.cpp*  Part of  :  MGuard*  Created  :  July 21 by xueyw*  Description:*  Copyright: * ============================================================================*///  Include Files  #include "MGuardKeyCapture.h"#include <e32base.h>#include <e32std.h>#include <apgwgnam.h>           // CApaWindowGroupName#include <aknkeylock.h> #include <apacmdln.h>#include <eikdll.h>// Capture KNumberOfPressesToCapture key pressesconst TInt KNumberOfPressesToCapture = 3;////////////////////////////////////// CGuardKeyCapturer////////////////////////////////////// Constructor//	CGuardKeyCapturer CGuardKeyCapturer::iKeyCapture;CGuardKeyCapturer::CGuardKeyCapturer() :CActive( EPriorityNormal ){	iCaptureStarted = EFalse;	iCapturePending = EFalse;	iCaptureHandleCount = 0;			// Connect to the window server	User::LeaveIfError( iWsSession.Connect() );	// Create an invisible window group. Well, we'll make it invisible later	/** @@todo Can ELeave be used with R-classes? */	iWindowGroup = new (ELeave) RWindowGroup ( iWsSession );	// @@see RBlankWindow::Construct	iWindowGroup->Construct( (TUint32)iWindowGroup, EFalse );}// DestructorCGuardKeyCapturer::~CGuardKeyCapturer(){	delete iWindowGroupName;	delete iWindowGroup;	iWsSession.Close();}// Cancel listening to key pressesvoid CGuardKeyCapturer::DoCancel(){	for ( TInt aIndex = 0; aIndex < iCaptureHandleCount; aIndex ++ )	{		iWindowGroup->CancelCaptureKey( iCaptureHandle[ aIndex ] );	}		RAknKeyLock keyLock; // first step	//	Lock keyboard	User::LeaveIfError(keyLock.Connect());  // second step	CleanupClosePushL(keyLock);	keyLock.DisableKeyLock(); // third step	keyLock.Close(); // fourth step	CleanupStack::PopAndDestroy(); // keyLock}void CGuardKeyCapturer::StopCapturingL(){	for ( TInt aIndex = 0; aIndex < iCaptureHandleCount; aIndex ++ )	{		iWindowGroup->CancelCaptureKey( iCaptureHandle[ aIndex ] );	}		RAknKeyLock keyLock; // first step	//	Lock keyboard	User::LeaveIfError(keyLock.Connect());  // second step	CleanupClosePushL(keyLock);	keyLock.DisableKeyLock(); // third step	keyLock.Close(); // fourth step	CleanupStack::PopAndDestroy(); // keyLock			iCaptureHandleCount = 0;	iCapturePending = ETrue;}void CGuardKeyCapturer::ResumeCapturingL(){	iCaptureHandleCount = 0;	User::LeaveIfError( iCaptureHandle[iCaptureHandleCount] = iWindowGroup->CaptureKey( EKeyLeftArrow , 0, 0 ) );	iCaptureHandleCount ++;	//////User::LeaveIfError( iCaptureHandle[iCaptureHandleCount] = iWindowGroup->CaptureKey( EKeyRightArrow , 0, 0 ) );	//////iCaptureHandleCount ++;	//////User::LeaveIfError( iCaptureHandle[iCaptureHandleCount] = iWindowGroup->CaptureKey( EKeyUpArrow , 0, 0 ) );	//////iCaptureHandleCount ++;	//////User::LeaveIfError( iCaptureHandle[iCaptureHandleCount] = iWindowGroup->CaptureKey( EKeyDownArrow , 0, 0 ) );	//////iCaptureHandleCount ++;	//////User::LeaveIfError( iCaptureHandle[iCaptureHandleCount] = iWindowGroup->CaptureKey( EKeyApplication0, 0, 0 ) );	//////iCaptureHandleCount ++;	//////User::LeaveIfError( iCaptureHandle[iCaptureHandleCount] = iWindowGroup->CaptureKey( EKeyYes , 0, 0 ) );	//////iCaptureHandleCount ++;	//////User::LeaveIfError( iCaptureHandle[iCaptureHandleCount] = iWindowGroup->CaptureKey( EKeyNo , 0, 0 ) );	//////iCaptureHandleCount ++;	//User::LeaveIfError( iCaptureHandle[iCaptureHandleCount] = iWindowGroup->CaptureKey( EKeyNull , 0, 0 ) );	//iCaptureHandleCount ++;	//User::LeaveIfError( iCaptureHandle[iCaptureHandleCount] = iWindowGroup->CaptureKey( EKeyBell , 0, 0 ) );		//iCaptureHandleCount ++;	//User::LeaveIfError( iCaptureHandle[iCaptureHandleCount] = iWindowGroup->CaptureKey( EKeyBackspace , 0, 0 ) );		//iCaptureHandleCount ++;	//User::LeaveIfError( iCaptureHandle[iCaptureHandleCount] = iWindowGroup->CaptureKey( EKeyTab , 0, 0 ) );		//iCaptureHandleCount ++;	//User::LeaveIfError( iCaptureHandle[iCaptureHandleCount] = iWindowGroup->CaptureKey( EKeyLineFeed , 0, 0 ) );	//iCaptureHandleCount ++;	//User::LeaveIfError( iCaptureHandle[iCaptureHandleCount] = iWindowGroup->CaptureKey( EKeyVerticalTab , 0, 0 ) );		//iCaptureHandleCount ++;	//User::LeaveIfError( iCaptureHandle[iCaptureHandleCount] = iWindowGroup->CaptureKey( EKeyFormFeed , 0, 0 ) );		//iCaptureHandleCount ++;	//User::LeaveIfError( iCaptureHandle[iCaptureHandleCount] = iWindowGroup->CaptureKey( EKeyEnter , 0, 0 ) );		//iCaptureHandleCount ++;	//User::LeaveIfError( iCaptureHandle[iCaptureHandleCount] = iWindowGroup->CaptureKey( EKeyEscape , 0, 0 ) );	//iCaptureHandleCount ++;	//User::LeaveIfError( iCaptureHandle[iCaptureHandleCount] = iWindowGroup->CaptureKey( EKeySpace , 0, 0 ) );		//iCaptureHandleCount ++;	//User::LeaveIfError( iCaptureHandle[iCaptureHandleCount] = iWindowGroup->CaptureKey( EKeyBackspace , 0, 0 ) );		//iCaptureHandleCount ++;	//User::LeaveIfError( iCaptureHandle[iCaptureHandleCount] = iWindowGroup->CaptureKey( EKeyDelete , 0, 0 ) );		//iCaptureHandleCount ++;	//	//for ( TInt aCode = EKeyPrintScreen; aCode < EKeyDecBrightness; aCode ++ )	//{	//	User::LeaveIfError( iCaptureHandle[iCaptureHandleCount] = iWindowGroup->CaptureKey( aCode , 0, 0 ) );	//	iCaptureHandleCount ++;	//}	iCapturePending = EFalse;			RAknKeyLock keyLock; // first step	//	Start phone app	_LIT(KPhoneAppPath, "\\system\\apps\\phone\\phone.app");	{		//	Open with the default/last known app		CApaCommandLine * cmd = CApaCommandLine::NewL();        		cmd->SetLibraryNameL( KPhoneAppPath );        		cmd->SetCommandL( EApaCommandOpen );		EikDll::StartAppL( *cmd );		delete cmd;	}	//	Lock keyboard	User::LeaveIfError(keyLock.Connect());  // second step	CleanupClosePushL(keyLock);	keyLock.EnableKeyLock(); // third step	keyLock.Close(); // fourth step	CleanupStack::PopAndDestroy(); // keyLock	}void CGuardKeyCapturer::StartCapturingL() {	// You cannot just call CaptureLongKey for the same key code	// You MUST call CaptureKey first	iCaptureHandleCount = 0;	User::LeaveIfError( iCaptureHandle[iCaptureHandleCount] = iWindowGroup->CaptureKey( EKeyLeftArrow , 0, 0 ) );	iCaptureHandleCount ++;	//////User::LeaveIfError( iCaptureHandle[iCaptureHandleCount] = iWindowGroup->CaptureKey( EKeyRightArrow , 0, 0 ) );	//////iCaptureHandleCount ++;	//////User::LeaveIfError( iCaptureHandle[iCaptureHandleCount] = iWindowGroup->CaptureKey( EKeyUpArrow , 0, 0 ) );	//////iCaptureHandleCount ++;	//////User::LeaveIfError( iCaptureHandle[iCaptureHandleCount] = iWindowGroup->CaptureKey( EKeyDownArrow , 0, 0 ) );	//////iCaptureHandleCount ++;

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -