Click here to Skip to main content
15,896,063 members
Articles / Mobile Apps / Windows Mobile

Windows Mobile: Redirect Function Keys into Internet Explorer Mobile Browser

Rate me:
Please Sign up or sign in to vote.
0.00/5 (No votes)
1 Oct 2012CPOL2 min read 8.7K   7   1  
This small tool enables you to use Function keys within Internet Explorer Mobile (IEM) web sites.
// Undocumented though operational though unsupported Hooks: types and structs

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000

#include <windows.h>
#include <winuser.h>

#define MYMSG_TASKBARNOTIFY  (WM_USER + 100)

#define WH_MIN      				(-1)
#define WH_MSGFILTER    		(-1)
#define WH_JOURNALRECORD  		0
#define WH_JOURNALPLAYBACK  	1
#define WH_KEYBOARD    			2
#define WH_GETMESSAGE   		3
#define WH_CALLWNDPROC   		4
#define WH_CBT      				5
#define WH_SYSMSGFILTER   		6
#define WH_MOUSE     			7
#define WH_HARDWARE    			8
#define WH_DEBUG     			9
#define WH_SHELL     			10
#define WH_FOREGROUNDIDLE  	11
#define WH_MAX      				11

#define WH_KEYBOARD_LL   		20

#define HC_ACTION           	0
#define HC_GETNEXT          	1
#define HC_SKIP             	2
#define HC_NOREMOVE         	3
#define HC_SYSMODALON       	4
#define HC_SYSMODALOFF      	5

#define HC_NOREM            	HC_NOREMOVE

#define WH_CBT              	5
#define GWL_HINSTANCE       	-6
#define HCBT_ACTIVATE       	5

// Used by WH_KEYBOARD_LL
#define LLKHF_EXTENDED       	(KF_EXTENDED >> 8)
#define LLKHF_INJECTED       	0x00000010
#define LLKHF_ALTDOWN        	(KF_ALTDOWN >> 8)
#define LLKHF_UP             	(KF_UP >> 8)
#define LLMHF_INJECTED       	0x00000001

// Define the function types used by hooks
typedef LRESULT	(CALLBACK* HOOKPROC)(int code, WPARAM wParam, LPARAM lParam);
typedef HHOOK 		(WINAPI *_SetWindowsHookExW)(int, HOOKPROC, HINSTANCE, DWORD);
typedef LRESULT	(WINAPI *_CallNextHookEx)(HHOOK, int, WPARAM, LPARAM);
typedef LRESULT	(WINAPI *_UnhookWindowsHookEx)(HHOOK);

// Apparently undefined in HPC 2.11. Defined in basetsd.h in PocketPC 2002 (shared by HPC 2K).
typedef unsigned long ULONG_PTR, *PULONG_PTR;

// For the low level keyboard hook, you are passed a pointer to one of these
typedef struct {
    DWORD vkCode;
    DWORD scanCode;
    DWORD flags;
    DWORD time;
    ULONG_PTR dwExtraInfo;
} KBDLLHOOKSTRUCT, *PKBDLLHOOKSTRUCT;


// Win32 Hook APIs (manually loaded)
static _SetWindowsHookExW 		SetWindowsHookEx;
static _UnhookWindowsHookEx	UnhookWindowsHookEx;
static _CallNextHookEx  		CallNextHookEx;		

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Germany Germany
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions