Look at the header file of Microsoft pwinuser. H, which contains the hook api.
# Ifndef _ priv_winuser _
# DEFINE _ priv_winuser _
# Ifdef _ cplusplus
Extern "C "{
# Endif
# Include <keybd. h>
// Non-standard ce Internal messages.
# Define wm_qm_activate 0x60
# Define wm_hook_do_callback 0x61
# Define wm_syscopydata 0x62
// Wparam values for wm_syscopydata
# Define wmscd_char_ranked_alts 0x01
# Define wmscd_dialogscrollbar 0x02
/*
* Extended window styles
*/
# If (winver> = 0x0400)
# Endif/* winver> = 0x0400 */
// Marker for end of accelerator tables.
# Define flastkey 0x80
// Setwindowpos internal flags
# Define swp_systemcapture 0x80000000
# Define swp_findnewforeground 0x40000000
# Define swp_maxmin 0x20000000
// Internal values for hwnd for use in broadcasting messages
// Must be odd numbered.
# Define hwnd_toplevelvisibleorpre30 (hwnd) 0 xfffd) // top level windows that are visible on screen or VER <3.0
# Define hwnd_toplevelchild (hwnd) 0 xfffb) // top level windows with the ws_child bit set
/*
* Predefined clipboard formats
*/
# Define cf_metafilepict 3
# Define cf_enhmetafile 14
# Define cf_hdrop 15
# Define image_enhmetafile 3
Void winapi systemidletimerreset (void );
Hwnd winapi setkeyboardtarget (hwnd );
Hwnd winapi getkeyboardtarget (void );
Key_state_flags winapi getasyncshiftflags (uint vkey );
Winuserapi void winapi accessibilitysoundsentryevent (void );
Bool winapi immenableime (DWORD );
HKL winapi immgetkeyboardlayout (DWORD dwthreadid );
/*
* Immassociatevaluewithgwesmessagequeue flags
*
* These is not hard & fast rule for the # s given below-just
* That they are ordered in pairs of get/Set Operations
*/
# Define imm_getthreadhkl 1
# Define imm_setthreadhkl 2
# Define imm_getthreadprevhkl 3
# Define imm_setthreadprevhkl 4
# Define imm_setprocesshkl 6
# Define imm_set_thread_ime_default_hwnd 8
# Define imm_get_laymgr_status 9
Void audioupdatefromregistry (void );
/* Values for notifywinusersystem */
# Define nwus_double_tap_changed 1
# Define nwus_keybd_repeat_changed 2
# Define nwus_max_idle_time_changed 3
# Define spi_setnosehforvalidation 250
# Define mod_keyup_always 0x2000
Typedef struct tagplatformversion {
DWORD dwmajor;
DWORD dwminor;
} Platformversion, * pplatformversion;
# Define spi_project1 224
# Define spi_project2 225
# Define spi_project3 226
# Define spi_project4 227
# Define spi_project 228
# Define spi_project6 229
# Define spi_project7 230
# Define spi_project 231
# Define spi_project9 232
# Define spi_project10 233
# Define spi_project11 234
# Define spi_project12 235
# Define spi_project13 236
# Define spi_project 14 237
# Define spi_project15 238
# Define spi_project16 239
# Define spi_getplatformversion spi_project1
# Define vk_app_launch0xc1
# Define vk_app_launch2 0xc2
# Define vk_app_launch3 0xc3
# Define vk_app_launc40xc4
# Define vk_app_launch5 0xc5
# Define vk_app_launch6 0xc6
# Define vk_app_launch7 0xc7
# Define vk_app_launch8 0xc8
# Define vk_app_launch9 0xc9
# Define vk_app_launch10 0xca
# Define vk_app_launch11 0xcb
# Define vk_app_launch12 0xcc
# Define vk_app_launch13 0xcd
# Define vk_app_launch14 0xce
# Define vk_app_launch15 0xcf
Void winapi yywinusersystem (uint uevent );
Bool winapi registertaskbar (hwnd hwndtaskbar );
Bool winapi registertaskbarex (hwnd hwndtaskbar, bool btaskbarontop );
Bool winapi registerdesktop (hwnd hwnddesktop );
Winuserapi bool winapi rectangleanimation (hwnd, lpcrect PRC, bool fmaximize );
Void winapi shellmodalend (void );
// # Define exitwindows (dwreserved, code) exitwindowsex (ewx_logoff, 0 xffffffff)
// Winuserapi bool winapi exitwindowsex (uint uflags, DWORD dwreserved );
Void gwespoweroffsystem (void );
Bool gwespowerdown (void );
Void gwespowerup (bool );
Void winapi batterygetlifetimeinfo (lpsystemtime pstlastchange, DWORD * pcmscpuusage, DWORD * pcmspreviouscpuusage );
Long winapi batterydrvrgetlevels (void );
Bool winapi batterydrvrsupportschangenotification (void );
Void winapi batterynotifyoftimechange (bool fforward, filetime * pftdelta );
// A system class built in to GWe for use by everyone
# Define cs_systemclass 0x80000000
/* Flags for drawframecontrol */
// # Define dfc_caption 1
# Define dfc_menu 2
// # Define dfc_scroll 3
// # Define dfc_button 4
# Define dfc_spinner 6
// # Define dfcs_captionclose 0x0000
// # Define dfcs_captionmin 0x0001
// # Define dfcs_captionmax 0x0002
// # Define dfcs_captionrestore 0x0003
// # Define dfcs_captionhelp 0x0004
// # Define dfcs_captionokbtn 0x0080
# Define dfcs_captionroundokbtn_wince 0x0010
# Define dfcs_captionroundclose_windows 0x0020
# Define dfcs_captionall_wince 0x00f0
# Define dfcs_menuarrow 0x0000
# Define dfcs_menucheck 0x0001
# Define dfcs_menubullet 0x0002
# Define dfcs_menuarrowright 0x0004
/// # Define dfcs_scrollup 0x0000
// # Define dfcs_scrolldown 0x0001
// # Define dfcs_scrollleft 0x0002
// # Define dfcs_scrollright 0x0003
// # Define dfcs_scrollcombobox 0x0005
# Define dfcs_scrollsizegrip 0x0008
# Define dfcs_scrollsizegripright 0x0010
// # Define dfcs_buttoncheck 0x0000
# Define dfcs_buttonradioimage 0x0001
# Define dfcs_buttonradiomask 0x0002
// # Define dfcs_buttonradio 0x0004
// # Define dfcs_button3state 0x0008
// # Define dfcs_buttonpush 0x0010
# Define dfcs_spinnerup 0x0000
# Define dfcs_spinnerdown 0x0001
# Define dfcs_spinnerleft 0x0002
# Define dfcs_spinnerright 0x0003
# Define dfcs_spinnerbutton 0x0010
# Define dfcs_spinnernoborder 0x0020
// # Define dfcs_inactive 0x0100
// # Define dfcs_pushed 0x0200
// # Define dfcs_checked 0x0400
# Define dfcs_adjustrect 0x2000
# Define dfcs_flat 0X4000
# Define dfcs_mono 0x8000
# Define mft_nonownerstring 0x80000000l
// Winuserapi bool winapi drawframecontrol (HDC, lprect, uint, uint );
// NC messages
# Define wm_nccreate 0x0081
# Define wm_ncdestroy 0x0082
# Define wm_nccalcsize 0x0083
# Define wm_nchittest 0x0084
# Define wm_ncpaint 0x0085
# Define wm_ncactivate 0x0086
# Define wm_ncmousefirst 0x00a0
# Define wm_ncmousemove 0x00a0
# Define wm_nclbuttondown 0x00a1
# Define wm_nclbuttonup 0x00a2
# Define wm_nclbuttondblclk 0x00a3
# Define wm_ncrbuttondown 0x00a4
# Define wm_ncrbuttonup 0x00a5
# Define wm_ncrbuttondblclk 0x00a6
# Define wm_ncmbuttondown 0x00a7
# Define wm_ncmbuttonup 0x00a8
# Define wm_ncmbuttondblclk 0x00a9
# Define wm_ncxbuttondown 0x00ab
# Define wm_ncxbuttonup 0x00ac
# Define wm_ncxbuttondblclk 0x00ad
# Define wm_ncmouselast 0x00ad
# Ifdef Fareast
/* Class style for ime ui window */
# Define cs_ime 0x00010000
# Endif // Fareast
# Ifdef _ win32_wce_emulation
# Ifdef cs_ime
# UNDEF cs_ime
# Endif
# Define cs_ime 0x00010000
# Endif
/* For internal APIs "Exposed" to other internal pieces .*/
# Ifdef _ cplusplus
# Define extern_c extern "C"
# Else
# Define extern_c extern
# Endif/* _ cplusplus */
# Define intapi extern_c long _ stdcall
# Define intapi _ (type) extern_c type _ stdcall
Bool keybdgetdeviceinfo (INT iindex, lpvoid lpoutput );
Bool keybdinitstates (key_state keystate, void * pkeybddriverstate );
Uint32 keybdvkeytounicode (
Uint32 vkey,
Key_state_flags keyeventflags,
Key_state keystate,
Void * keybddriverstate,
Uint32 cbuffersize,
Uint32 * pccharacters,
Key_state_flags * pshiftstatebuffer,
Uint32 * pcharacterbuffer
);
// Maximum # of slots available in preload reg key.
# Define max_hkl_preload_count 15
# Define wh_journalrecord 0
# Define wh_journalplayback 1
# Define wh_keyboard_ll 20
/*
* Hook Codes
*/
# Define hc_action 0
# Define hc_getnext 1
# Define hc_skip 2
# Define hc_noremove 3
# Define hc_norem hc_noremove
# Define hc_sysmodeon 4
# Define hc_sysmodaloff 5
Typedef lresult (callback * hookproc) (INT code, wparam, lparam );
/*
* Message structure used in journaling
*/
Typedef struct tageventmsg {
Uint message;
Uint paraml;
Uint paramh;
DWORD time;
Hwnd;
} Eventmsg, * peventmsgmsg, near * npeventmsgmsg, far * lpeventmsgmsg;
Typedef struct tageventmsg * peventmsg, near * npeventmsg, far * lpeventmsg;
Hhook
Winapi
Qasetwindowsjournalhook (
Int nfiltertype,
Hookproc pfnfilterproc,
Eventmsg * pfneventmsg
);
Bool
Winapi
Qaunhookwindowsjournalhook (
Int nfiltertype
);
Bool
Winapi
Getmessagewnowait (
PMSG,
Hwnd,
Uint wmsgfiltermin,
Uint wmsgfiltermax
);
Bool
Winapi
Touchcalibrate (
Void
);
Int
Winapi
Disablecaretsystemwide (
Void
);
Int
Winapi
Enablecaretsystemwide (
Void
);
Bool
Winapi
Enablehardwarekeyboard (
Bool fenable
);
Bool registersipanel (hwnd hwndsipanel );
Void winapi setassociatedmenu (
Hwnd,
Hmenu
);
Hmenu winapi getassociatedmenu (
Hwnd
);
Bool
Winapi
Unregisterfunc1 (
Uint fsmodifiers,
Uint VK
);
Typedef struct tagkbdllhookstruct {
DWORD vkcode; // virtual key code
DWORD scancode; // scan code DWORD flags; // flags
DWORD flags; // unused
DWORD time; // time stamp for this message
DWORD dwextrainfo; // extra info from the driver or keybd_event
} KBDLLHOOKSTRUCT, * pkbdllhookstruct;
Hhook
Winapi
Setwindowshookexw (
Int idhook,
Hookproc lpfn,
Hinstance hmod,
DWORD dwthreadid );
# Define setwindowshookex setwindowshookexw
Bool
Winapi
Unhookwindowshookex (
Hhook HHK );
Lresult
Winapi
Callnexthookex (
Hhook HHK,
Int ncode,
Wparam,
Lparam );
Typedef struct taggetforegroundinfo
{
Hwnd hwndactive;
Hwnd hwndfocus;
Hwnd hwndmenu;
Hwnd hwndkeyboarddest;
DWORD fdwconversion;
DWORD fdwsentence;
Bool fopen;
DWORD dwcompstrlen;
HKL keyboardlayouthandle;
} Get_foreground_info;
Bool
Winapi
Getforegroundinfo (
Get_foreground_info * pgfi
);
Hwnd getforegroundkeyboardtarget (
Void
);
HKL
Getforegroundkeyboardlayouthandle (
Void
);
Bool
Winapi
Immgetconversionstatusforeground (
DWORD * pfdwconversion,
DWORD * pfdwsentence
);
Bool
Showstartupwindow (
Void
);
// This is taken directly from PBT. H. Not all values are used or supported.
# Ifndef wm_powerbroadcast
# Define wm_powerbroadcast 0x218
# Endif
# Define pbt_apmquerysuspend 0x0000
# Define pbt_apmquerystandby 0x0001
# Define pbt_apmquerysuspendfailed 0x0002
# Define pbt_apmquerystandbyfailed 0x0003
# Define pbt_apmsuspend 0x0004
# Define pbt_apmstandby 0x0005
# Define pbt_apmresumecritical 0x0006
# Define pbt_apmresumesuspend 0x0007
# Define pbt_apmresumestandby 0x0008
# Define pbtf_apmresumefromfailure 0x00000001
# Define pbt_apmbatterylow 0x0009
# Define pbt_apmpowerstatuschange 0x000a
# Define pbt_apmoemevent 0x000b
# Define pbt_apmuseridle 0x000c
# Define pbt_apmuseractive 0x000d
// @ Cesysgen if gwes_winmgr
// Events sent by GWES to the shell
// Codes used in wm_shellnotify
# Define shellpolicy_windowcreated 0x0006
# Define shellpolicy_windowdestroyed 0x0007
# Define shellpolicy_windowactivated 0x0008
# Define shellpolicy_redraw 0x0009
# Define shellpolicy_language 0x000a
# Define shellpolicy_capslock 0x000b
# Define shellpolicy_reserved0x000c 0x000c
# Define shellpolicy_reserved0x000d 0x000d
// @ Cesysgen endif
# Ifdef _ cplusplus
}
# Endif/* _ cplusplus */
# Endif/* _ priv_winuser _*/