Fixed highlighting around WPF and Silverlight, fixed windows commands to use WPF runtimeIds,Adding Windows Message hook feature
When targeting WPF and silverlight applications synthuse will now target each object with a red rectangle, just like it does with native win 32 applications. Windows commands like setfocus and such are now supported with UIA objects like (WPF, WinForm, Silverlight). Adding support for hooking in to the Message Queue of a target window to see what Messages are being sent, this will allow one to possible resend the messages back for automation purposes. This feature is not fully working yet, but is close.
This commit is contained in:
300
native/MsgHookTest/MsgHook.h
Normal file
300
native/MsgHookTest/MsgHook.h
Normal file
@@ -0,0 +1,300 @@
|
||||
#include <windows.h>
|
||||
|
||||
#define MSGHOOKER_FILE TEXT("MsgHook.dll")
|
||||
|
||||
HINSTANCE msgHookDll;
|
||||
|
||||
//BOOL SetHook(HWND callerHWnd, DWORD threadId)
|
||||
typedef BOOL (* SETHOOK)(HWND, DWORD);
|
||||
SETHOOK SetHook;
|
||||
|
||||
//BOOL RemoveHook()
|
||||
typedef BOOL (* REMOVEHOOK)(VOID);
|
||||
REMOVEHOOK RemoveHook;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
int nCode;
|
||||
DWORD dwHookType;
|
||||
WPARAM wParam;
|
||||
LPARAM lParam;
|
||||
}HEVENT;
|
||||
|
||||
/*
|
||||
typedef struct {
|
||||
DWORD vkCode;
|
||||
DWORD scanCode;
|
||||
DWORD flags;
|
||||
DWORD time;
|
||||
ULONG_PTR dwExtraInfo;
|
||||
} KBDLLHOOKSTRUCT, *PKBDLLHOOKSTRUCT;
|
||||
*/
|
||||
|
||||
BOOL InitHook(HWND hw, int threadId)
|
||||
{
|
||||
msgHookDll = LoadLibrary(MSGHOOKER_FILE);
|
||||
if (msgHookDll != NULL)
|
||||
{
|
||||
SetHook = (SETHOOK)GetProcAddress(msgHookDll, "SetHook");
|
||||
RemoveHook = (REMOVEHOOK)GetProcAddress(msgHookDll, "RemoveHook");
|
||||
if (SetHook)
|
||||
{
|
||||
return SetHook(hw, threadId);
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
void KillHook()
|
||||
{
|
||||
if (RemoveHook)
|
||||
RemoveHook();
|
||||
|
||||
if (msgHookDll != NULL)
|
||||
FreeLibrary(msgHookDll);
|
||||
}
|
||||
|
||||
// MSG Array LOOKUP
|
||||
const int MAX_MSG_LOOKUP = 1024;
|
||||
const int MAX_MSG_NAME = 21;
|
||||
TCHAR MSG_LOOKUP[MAX_MSG_LOOKUP][MAX_MSG_NAME] = {
|
||||
};
|
||||
|
||||
|
||||
//void InitializeMsgLookup() below
|
||||
void InitializeMsgLookup(int allowList[], int allowSize)
|
||||
{
|
||||
for (int i = 0 ; i < MAX_MSG_LOOKUP ; i++)
|
||||
{
|
||||
bool allowFlg = true;
|
||||
if (allowSize > 0)
|
||||
allowFlg = false;
|
||||
for (int a = 0 ; a < allowSize ; a++)
|
||||
if (allowList[a] == i)
|
||||
allowFlg = true;
|
||||
if (!allowFlg)
|
||||
continue;
|
||||
switch (i)
|
||||
{
|
||||
case WM_NULL: _tcscpy_s(MSG_LOOKUP[i], _T("WM_NULL")); break;
|
||||
case WM_CREATE: _tcscpy_s(MSG_LOOKUP[i], _T("WM_CREATE")); break;
|
||||
case WM_DESTROY: _tcscpy_s(MSG_LOOKUP[i], _T("WM_DESTROY")); break;
|
||||
case WM_MOVE: _tcscpy_s(MSG_LOOKUP[i], _T("WM_MOVE")); break;
|
||||
case WM_SIZE: _tcscpy_s(MSG_LOOKUP[i], _T("WM_SIZE")); break;
|
||||
case WM_ACTIVATE: _tcscpy_s(MSG_LOOKUP[i], _T("WM_ACTIVATE")); break;
|
||||
case WM_SETFOCUS: _tcscpy_s(MSG_LOOKUP[i], _T("WM_SETFOCUS")); break;
|
||||
case WM_KILLFOCUS: _tcscpy_s(MSG_LOOKUP[i], _T("WM_KILLFOCUS")); break;
|
||||
case WM_ENABLE: _tcscpy_s(MSG_LOOKUP[i], _T("WM_ENABLE")); break;
|
||||
case WM_SETREDRAW: _tcscpy_s(MSG_LOOKUP[i], _T("WM_SETREDRAW")); break;
|
||||
case WM_SETTEXT: _tcscpy_s(MSG_LOOKUP[i], _T("WM_SETTEXT")); break;
|
||||
case WM_GETTEXT: _tcscpy_s(MSG_LOOKUP[i], _T("WM_GETTEXT")); break;
|
||||
case WM_GETTEXTLENGTH: _tcscpy_s(MSG_LOOKUP[i], _T("WM_GETTEXTLENGTH")); break;
|
||||
case WM_PAINT: _tcscpy_s(MSG_LOOKUP[i], _T("WM_PAINT")); break;
|
||||
case WM_CLOSE: _tcscpy_s(MSG_LOOKUP[i], _T("WM_CLOSE")); break;
|
||||
case WM_QUERYENDSESSION: _tcscpy_s(MSG_LOOKUP[i], _T("WM_QUERYENDSESSION")); break;
|
||||
case WM_QUIT: _tcscpy_s(MSG_LOOKUP[i], _T("WM_QUIT")); break;
|
||||
case WM_QUERYOPEN: _tcscpy_s(MSG_LOOKUP[i], _T("WM_QUERYOPEN")); break;
|
||||
case WM_ERASEBKGND: _tcscpy_s(MSG_LOOKUP[i], _T("WM_ERASEBKGND")); break;
|
||||
case WM_SYSCOLORCHANGE: _tcscpy_s(MSG_LOOKUP[i], _T("WM_SYSCOLORCHANGE")); break;
|
||||
case WM_ENDSESSION: _tcscpy_s(MSG_LOOKUP[i], _T("WM_ENDSESSION")); break;
|
||||
case 0x17: _tcscpy_s(MSG_LOOKUP[i], _T("WM_SYSTEMERROR")); break;
|
||||
case WM_SHOWWINDOW: _tcscpy_s(MSG_LOOKUP[i], _T("WM_SHOWWINDOW")); break;
|
||||
case 0x19: _tcscpy_s(MSG_LOOKUP[i], _T("WM_CTLCOLOR")); break;
|
||||
case WM_WININICHANGE: _tcscpy_s(MSG_LOOKUP[i], _T("WM_WININICHANGE")); break;
|
||||
//case WM_SETTINGCHANGE: _tcscpy_s(MSG_LOOKUP[i], _T("WM_SETTINGCHANGE")); break;
|
||||
case WM_DEVMODECHANGE: _tcscpy_s(MSG_LOOKUP[i], _T("WM_DEVMODECHANGE")); break;
|
||||
case WM_ACTIVATEAPP: _tcscpy_s(MSG_LOOKUP[i], _T("WM_ACTIVATEAPP")); break;
|
||||
case WM_FONTCHANGE: _tcscpy_s(MSG_LOOKUP[i], _T("WM_FONTCHANGE")); break;
|
||||
case WM_TIMECHANGE: _tcscpy_s(MSG_LOOKUP[i], _T("WM_TIMECHANGE")); break;
|
||||
case WM_CANCELMODE: _tcscpy_s(MSG_LOOKUP[i], _T("WM_CANCELMODE")); break;
|
||||
case WM_SETCURSOR: _tcscpy_s(MSG_LOOKUP[i], _T("WM_SETCURSOR")); break;
|
||||
case WM_MOUSEACTIVATE: _tcscpy_s(MSG_LOOKUP[i], _T("WM_MOUSEACTIVATE")); break;
|
||||
case WM_CHILDACTIVATE: _tcscpy_s(MSG_LOOKUP[i], _T("WM_CHILDACTIVATE")); break;
|
||||
case WM_QUEUESYNC: _tcscpy_s(MSG_LOOKUP[i], _T("WM_QUEUESYNC")); break;
|
||||
case WM_GETMINMAXINFO: _tcscpy_s(MSG_LOOKUP[i], _T("WM_GETMINMAXINFO")); break;
|
||||
case WM_PAINTICON: _tcscpy_s(MSG_LOOKUP[i], _T("WM_PAINTICON")); break;
|
||||
case WM_ICONERASEBKGND: _tcscpy_s(MSG_LOOKUP[i], _T("WM_ICONERASEBKGND")); break;
|
||||
case WM_NEXTDLGCTL: _tcscpy_s(MSG_LOOKUP[i], _T("WM_NEXTDLGCTL")); break;
|
||||
case WM_SPOOLERSTATUS: _tcscpy_s(MSG_LOOKUP[i], _T("WM_SPOOLERSTATUS")); break;
|
||||
case WM_DRAWITEM: _tcscpy_s(MSG_LOOKUP[i], _T("WM_DRAWITEM")); break;
|
||||
case WM_MEASUREITEM: _tcscpy_s(MSG_LOOKUP[i], _T("WM_MEASUREITEM")); break;
|
||||
case WM_DELETEITEM: _tcscpy_s(MSG_LOOKUP[i], _T("WM_DELETEITEM")); break;
|
||||
case WM_VKEYTOITEM: _tcscpy_s(MSG_LOOKUP[i], _T("WM_VKEYTOITEM")); break;
|
||||
case WM_CHARTOITEM: _tcscpy_s(MSG_LOOKUP[i], _T("WM_CHARTOITEM")); break;
|
||||
case WM_SETFONT: _tcscpy_s(MSG_LOOKUP[i], _T("WM_SETFONT")); break;
|
||||
case WM_GETFONT: _tcscpy_s(MSG_LOOKUP[i], _T("WM_GETFONT")); break;
|
||||
case WM_SETHOTKEY: _tcscpy_s(MSG_LOOKUP[i], _T("WM_SETHOTKEY")); break;
|
||||
case WM_GETHOTKEY: _tcscpy_s(MSG_LOOKUP[i], _T("WM_GETHOTKEY")); break;
|
||||
case WM_QUERYDRAGICON: _tcscpy_s(MSG_LOOKUP[i], _T("WM_QUERYDRAGICON")); break;
|
||||
case WM_COMPAREITEM: _tcscpy_s(MSG_LOOKUP[i], _T("WM_COMPAREITEM")); break;
|
||||
case WM_COMPACTING: _tcscpy_s(MSG_LOOKUP[i], _T("WM_COMPACTING")); break;
|
||||
case WM_WINDOWPOSCHANGING: _tcscpy_s(MSG_LOOKUP[i], _T("WM_WINDOWPOSCHANGING")); break;
|
||||
case WM_WINDOWPOSCHANGED: _tcscpy_s(MSG_LOOKUP[i], _T("WM_WINDOWPOSCHANGED")); break;
|
||||
case WM_POWER: _tcscpy_s(MSG_LOOKUP[i], _T("WM_POWER")); break;
|
||||
case WM_COPYDATA: _tcscpy_s(MSG_LOOKUP[i], _T("WM_COPYDATA")); break;
|
||||
case WM_CANCELJOURNAL: _tcscpy_s(MSG_LOOKUP[i], _T("WM_CANCELJOURNAL")); break;
|
||||
case WM_NOTIFY: _tcscpy_s(MSG_LOOKUP[i], _T("WM_NOTIFY")); break;
|
||||
case WM_INPUTLANGCHANGEREQUEST: _tcscpy_s(MSG_LOOKUP[i], _T("WM_INPUTLANGCHANGERE")); break;
|
||||
case WM_INPUTLANGCHANGE: _tcscpy_s(MSG_LOOKUP[i], _T("WM_INPUTLANGCHANGE")); break;
|
||||
case WM_TCARD: _tcscpy_s(MSG_LOOKUP[i], _T("WM_TCARD")); break;
|
||||
case WM_HELP: _tcscpy_s(MSG_LOOKUP[i], _T("WM_HELP")); break;
|
||||
case WM_USERCHANGED: _tcscpy_s(MSG_LOOKUP[i], _T("WM_USERCHANGED")); break;
|
||||
case WM_NOTIFYFORMAT: _tcscpy_s(MSG_LOOKUP[i], _T("WM_NOTIFYFORMAT")); break;
|
||||
case WM_CONTEXTMENU: _tcscpy_s(MSG_LOOKUP[i], _T("WM_CONTEXTMENU")); break;
|
||||
case WM_STYLECHANGING: _tcscpy_s(MSG_LOOKUP[i], _T("WM_STYLECHANGING")); break;
|
||||
case WM_STYLECHANGED: _tcscpy_s(MSG_LOOKUP[i], _T("WM_STYLECHANGED")); break;
|
||||
case WM_DISPLAYCHANGE: _tcscpy_s(MSG_LOOKUP[i], _T("WM_DISPLAYCHANGE")); break;
|
||||
case WM_GETICON: _tcscpy_s(MSG_LOOKUP[i], _T("WM_GETICON")); break;
|
||||
case WM_SETICON: _tcscpy_s(MSG_LOOKUP[i], _T("WM_SETICON")); break;
|
||||
case WM_NCCREATE: _tcscpy_s(MSG_LOOKUP[i], _T("WM_NCCREATE")); break;
|
||||
case WM_NCDESTROY: _tcscpy_s(MSG_LOOKUP[i], _T("WM_NCDESTROY")); break;
|
||||
case WM_NCCALCSIZE: _tcscpy_s(MSG_LOOKUP[i], _T("WM_NCCALCSIZE")); break;
|
||||
case WM_NCHITTEST: _tcscpy_s(MSG_LOOKUP[i], _T("WM_NCHITTEST")); break;
|
||||
case WM_NCPAINT: _tcscpy_s(MSG_LOOKUP[i], _T("WM_NCPAINT")); break;
|
||||
case WM_NCACTIVATE: _tcscpy_s(MSG_LOOKUP[i], _T("WM_NCACTIVATE")); break;
|
||||
case WM_GETDLGCODE: _tcscpy_s(MSG_LOOKUP[i], _T("WM_GETDLGCODE")); break;
|
||||
case WM_NCMOUSEMOVE: _tcscpy_s(MSG_LOOKUP[i], _T("WM_NCMOUSEMOVE")); break;
|
||||
case WM_NCLBUTTONDOWN: _tcscpy_s(MSG_LOOKUP[i], _T("WM_NCLBUTTONDOWN")); break;
|
||||
case WM_NCLBUTTONUP: _tcscpy_s(MSG_LOOKUP[i], _T("WM_NCLBUTTONUP")); break;
|
||||
case WM_NCLBUTTONDBLCLK: _tcscpy_s(MSG_LOOKUP[i], _T("WM_NCLBUTTONDBLCLK")); break;
|
||||
case WM_NCRBUTTONDOWN: _tcscpy_s(MSG_LOOKUP[i], _T("WM_NCRBUTTONDOWN")); break;
|
||||
case WM_NCRBUTTONUP: _tcscpy_s(MSG_LOOKUP[i], _T("WM_NCRBUTTONUP")); break;
|
||||
case WM_NCRBUTTONDBLCLK: _tcscpy_s(MSG_LOOKUP[i], _T("WM_NCRBUTTONDBLCLK")); break;
|
||||
case WM_NCMBUTTONDOWN: _tcscpy_s(MSG_LOOKUP[i], _T("WM_NCMBUTTONDOWN")); break;
|
||||
case WM_NCMBUTTONUP: _tcscpy_s(MSG_LOOKUP[i], _T("WM_NCMBUTTONUP")); break;
|
||||
case WM_NCMBUTTONDBLCLK: _tcscpy_s(MSG_LOOKUP[i], _T("WM_NCMBUTTONDBLCLK")); break;
|
||||
//case WM_KEYFIRST: _tcscpy_s(MSG_LOOKUP[i], _T("WM_KEYFIRST")); break;
|
||||
case WM_KEYDOWN: _tcscpy_s(MSG_LOOKUP[i], _T("WM_KEYDOWN")); break;
|
||||
case WM_KEYUP: _tcscpy_s(MSG_LOOKUP[i], _T("WM_KEYUP")); break;
|
||||
case WM_CHAR: _tcscpy_s(MSG_LOOKUP[i], _T("WM_CHAR")); break;
|
||||
case WM_DEADCHAR: _tcscpy_s(MSG_LOOKUP[i], _T("WM_DEADCHAR")); break;
|
||||
case WM_SYSKEYDOWN: _tcscpy_s(MSG_LOOKUP[i], _T("WM_SYSKEYDOWN")); break;
|
||||
case WM_SYSKEYUP: _tcscpy_s(MSG_LOOKUP[i], _T("WM_SYSKEYUP")); break;
|
||||
case WM_SYSCHAR: _tcscpy_s(MSG_LOOKUP[i], _T("WM_SYSCHAR")); break;
|
||||
case WM_SYSDEADCHAR: _tcscpy_s(MSG_LOOKUP[i], _T("WM_SYSDEADCHAR")); break;
|
||||
case WM_KEYLAST: _tcscpy_s(MSG_LOOKUP[i], _T("WM_KEYLAST")); break;
|
||||
case WM_IME_STARTCOMPOSITION: _tcscpy_s(MSG_LOOKUP[i], _T("WM_IME_STARTCOMPOSIT")); break;
|
||||
case WM_IME_ENDCOMPOSITION: _tcscpy_s(MSG_LOOKUP[i], _T("WM_IME_ENDCOMPOSITIO")); break;
|
||||
case WM_IME_COMPOSITION: _tcscpy_s(MSG_LOOKUP[i], _T("WM_IME_COMPOSITION")); break;
|
||||
//case WM_IME_KEYLAST: _tcscpy_s(MSG_LOOKUP[i], _T("WM_IME_KEYLAST")); break;
|
||||
case WM_INITDIALOG: _tcscpy_s(MSG_LOOKUP[i], _T("WM_INITDIALOG")); break;
|
||||
case WM_COMMAND: _tcscpy_s(MSG_LOOKUP[i], _T("WM_COMMAND")); break;
|
||||
case WM_SYSCOMMAND: _tcscpy_s(MSG_LOOKUP[i], _T("WM_SYSCOMMAND")); break;
|
||||
case WM_TIMER: _tcscpy_s(MSG_LOOKUP[i], _T("WM_TIMER")); break;
|
||||
case WM_HSCROLL: _tcscpy_s(MSG_LOOKUP[i], _T("WM_HSCROLL")); break;
|
||||
case WM_VSCROLL: _tcscpy_s(MSG_LOOKUP[i], _T("WM_VSCROLL")); break;
|
||||
case WM_INITMENU: _tcscpy_s(MSG_LOOKUP[i], _T("WM_INITMENU")); break;
|
||||
case WM_INITMENUPOPUP: _tcscpy_s(MSG_LOOKUP[i], _T("WM_INITMENUPOPUP")); break;
|
||||
case WM_MENUSELECT: _tcscpy_s(MSG_LOOKUP[i], _T("WM_MENUSELECT")); break;
|
||||
case WM_MENUCHAR: _tcscpy_s(MSG_LOOKUP[i], _T("WM_MENUCHAR")); break;
|
||||
case WM_ENTERIDLE: _tcscpy_s(MSG_LOOKUP[i], _T("WM_ENTERIDLE")); break;
|
||||
case WM_CTLCOLORMSGBOX: _tcscpy_s(MSG_LOOKUP[i], _T("WM_CTLCOLORMSGBOX")); break;
|
||||
case WM_CTLCOLOREDIT: _tcscpy_s(MSG_LOOKUP[i], _T("WM_CTLCOLOREDIT")); break;
|
||||
case WM_CTLCOLORLISTBOX: _tcscpy_s(MSG_LOOKUP[i], _T("WM_CTLCOLORLISTBOX")); break;
|
||||
case WM_CTLCOLORBTN: _tcscpy_s(MSG_LOOKUP[i], _T("WM_CTLCOLORBTN")); break;
|
||||
case WM_CTLCOLORDLG: _tcscpy_s(MSG_LOOKUP[i], _T("WM_CTLCOLORDLG")); break;
|
||||
case WM_CTLCOLORSCROLLBAR: _tcscpy_s(MSG_LOOKUP[i], _T("WM_CTLCOLORSCROLLBAR")); break;
|
||||
case WM_CTLCOLORSTATIC: _tcscpy_s(MSG_LOOKUP[i], _T("WM_CTLCOLORSTATIC")); break;
|
||||
case WM_MOUSEFIRST: _tcscpy_s(MSG_LOOKUP[i], _T("WM_MOUSEFIRST")); break;
|
||||
//case WM_MOUSEMOVE: _tcscpy_s(MSG_LOOKUP[i], _T("WM_MOUSEMOVE")); break;
|
||||
case WM_LBUTTONDOWN: _tcscpy_s(MSG_LOOKUP[i], _T("WM_LBUTTONDOWN")); break;
|
||||
case WM_LBUTTONUP: _tcscpy_s(MSG_LOOKUP[i], _T("WM_LBUTTONUP")); break;
|
||||
case WM_LBUTTONDBLCLK: _tcscpy_s(MSG_LOOKUP[i], _T("WM_LBUTTONDBLCLK")); break;
|
||||
case WM_RBUTTONDOWN: _tcscpy_s(MSG_LOOKUP[i], _T("WM_RBUTTONDOWN")); break;
|
||||
case WM_RBUTTONUP: _tcscpy_s(MSG_LOOKUP[i], _T("WM_RBUTTONUP")); break;
|
||||
case WM_RBUTTONDBLCLK: _tcscpy_s(MSG_LOOKUP[i], _T("WM_RBUTTONDBLCLK")); break;
|
||||
case WM_MBUTTONDOWN: _tcscpy_s(MSG_LOOKUP[i], _T("WM_MBUTTONDOWN")); break;
|
||||
case WM_MBUTTONUP: _tcscpy_s(MSG_LOOKUP[i], _T("WM_MBUTTONUP")); break;
|
||||
case WM_MBUTTONDBLCLK: _tcscpy_s(MSG_LOOKUP[i], _T("WM_MBUTTONDBLCLK")); break;
|
||||
case WM_MOUSEWHEEL: _tcscpy_s(MSG_LOOKUP[i], _T("WM_MOUSEWHEEL")); break;
|
||||
case WM_MOUSEHWHEEL: _tcscpy_s(MSG_LOOKUP[i], _T("WM_MOUSEHWHEEL")); break;
|
||||
case WM_PARENTNOTIFY: _tcscpy_s(MSG_LOOKUP[i], _T("WM_PARENTNOTIFY")); break;
|
||||
case WM_ENTERMENULOOP: _tcscpy_s(MSG_LOOKUP[i], _T("WM_ENTERMENULOOP")); break;
|
||||
case WM_EXITMENULOOP: _tcscpy_s(MSG_LOOKUP[i], _T("WM_EXITMENULOOP")); break;
|
||||
case WM_NEXTMENU: _tcscpy_s(MSG_LOOKUP[i], _T("WM_NEXTMENU")); break;
|
||||
case WM_SIZING: _tcscpy_s(MSG_LOOKUP[i], _T("WM_SIZING")); break;
|
||||
case WM_CAPTURECHANGED: _tcscpy_s(MSG_LOOKUP[i], _T("WM_CAPTURECHANGED")); break;
|
||||
case WM_MOVING: _tcscpy_s(MSG_LOOKUP[i], _T("WM_MOVING")); break;
|
||||
case WM_POWERBROADCAST: _tcscpy_s(MSG_LOOKUP[i], _T("WM_POWERBROADCAST")); break;
|
||||
case WM_DEVICECHANGE: _tcscpy_s(MSG_LOOKUP[i], _T("WM_DEVICECHANGE")); break;
|
||||
case WM_MDICREATE: _tcscpy_s(MSG_LOOKUP[i], _T("WM_MDICREATE")); break;
|
||||
case WM_MDIDESTROY: _tcscpy_s(MSG_LOOKUP[i], _T("WM_MDIDESTROY")); break;
|
||||
case WM_MDIACTIVATE: _tcscpy_s(MSG_LOOKUP[i], _T("WM_MDIACTIVATE")); break;
|
||||
case WM_MDIRESTORE: _tcscpy_s(MSG_LOOKUP[i], _T("WM_MDIRESTORE")); break;
|
||||
case WM_MDINEXT: _tcscpy_s(MSG_LOOKUP[i], _T("WM_MDINEXT")); break;
|
||||
case WM_MDIMAXIMIZE: _tcscpy_s(MSG_LOOKUP[i], _T("WM_MDIMAXIMIZE")); break;
|
||||
case WM_MDITILE: _tcscpy_s(MSG_LOOKUP[i], _T("WM_MDITILE")); break;
|
||||
case WM_MDICASCADE: _tcscpy_s(MSG_LOOKUP[i], _T("WM_MDICASCADE")); break;
|
||||
case WM_MDIICONARRANGE: _tcscpy_s(MSG_LOOKUP[i], _T("WM_MDIICONARRANGE")); break;
|
||||
case WM_MDIGETACTIVE: _tcscpy_s(MSG_LOOKUP[i], _T("WM_MDIGETACTIVE")); break;
|
||||
case WM_MDISETMENU: _tcscpy_s(MSG_LOOKUP[i], _T("WM_MDISETMENU")); break;
|
||||
case WM_ENTERSIZEMOVE: _tcscpy_s(MSG_LOOKUP[i], _T("WM_ENTERSIZEMOVE")); break;
|
||||
case WM_EXITSIZEMOVE: _tcscpy_s(MSG_LOOKUP[i], _T("WM_EXITSIZEMOVE")); break;
|
||||
case WM_DROPFILES: _tcscpy_s(MSG_LOOKUP[i], _T("WM_DROPFILES")); break;
|
||||
case WM_MDIREFRESHMENU: _tcscpy_s(MSG_LOOKUP[i], _T("WM_MDIREFRESHMENU")); break;
|
||||
case WM_IME_SETCONTEXT: _tcscpy_s(MSG_LOOKUP[i], _T("WM_IME_SETCONTEXT")); break;
|
||||
case WM_IME_NOTIFY: _tcscpy_s(MSG_LOOKUP[i], _T("WM_IME_NOTIFY")); break;
|
||||
case WM_IME_CONTROL: _tcscpy_s(MSG_LOOKUP[i], _T("WM_IME_CONTROL")); break;
|
||||
case WM_IME_COMPOSITIONFULL: _tcscpy_s(MSG_LOOKUP[i], _T("WM_IME_COMPOSITIONFU")); break;
|
||||
case WM_IME_SELECT: _tcscpy_s(MSG_LOOKUP[i], _T("WM_IME_SELECT")); break;
|
||||
case WM_IME_CHAR: _tcscpy_s(MSG_LOOKUP[i], _T("WM_IME_CHAR")); break;
|
||||
case WM_IME_KEYDOWN: _tcscpy_s(MSG_LOOKUP[i], _T("WM_IME_KEYDOWN")); break;
|
||||
case WM_IME_KEYUP: _tcscpy_s(MSG_LOOKUP[i], _T("WM_IME_KEYUP")); break;
|
||||
case WM_MOUSEHOVER: _tcscpy_s(MSG_LOOKUP[i], _T("WM_MOUSEHOVER")); break;
|
||||
case WM_NCMOUSELEAVE: _tcscpy_s(MSG_LOOKUP[i], _T("WM_NCMOUSELEAVE")); break;
|
||||
case WM_MOUSELEAVE: _tcscpy_s(MSG_LOOKUP[i], _T("WM_MOUSELEAVE")); break;
|
||||
case WM_CUT: _tcscpy_s(MSG_LOOKUP[i], _T("WM_CUT")); break;
|
||||
case WM_COPY: _tcscpy_s(MSG_LOOKUP[i], _T("WM_COPY")); break;
|
||||
case WM_PASTE: _tcscpy_s(MSG_LOOKUP[i], _T("WM_PASTE")); break;
|
||||
case WM_CLEAR: _tcscpy_s(MSG_LOOKUP[i], _T("WM_CLEAR")); break;
|
||||
case WM_UNDO: _tcscpy_s(MSG_LOOKUP[i], _T("WM_UNDO")); break;
|
||||
case WM_RENDERFORMAT: _tcscpy_s(MSG_LOOKUP[i], _T("WM_RENDERFORMAT")); break;
|
||||
case WM_RENDERALLFORMATS: _tcscpy_s(MSG_LOOKUP[i], _T("WM_RENDERALLFORMATS")); break;
|
||||
case WM_DESTROYCLIPBOARD: _tcscpy_s(MSG_LOOKUP[i], _T("WM_DESTROYCLIPBOARD")); break;
|
||||
case WM_DRAWCLIPBOARD: _tcscpy_s(MSG_LOOKUP[i], _T("WM_DRAWCLIPBOARD")); break;
|
||||
case WM_PAINTCLIPBOARD: _tcscpy_s(MSG_LOOKUP[i], _T("WM_PAINTCLIPBOARD")); break;
|
||||
case WM_VSCROLLCLIPBOARD: _tcscpy_s(MSG_LOOKUP[i], _T("WM_VSCROLLCLIPBOARD")); break;
|
||||
case WM_SIZECLIPBOARD: _tcscpy_s(MSG_LOOKUP[i], _T("WM_SIZECLIPBOARD")); break;
|
||||
case WM_ASKCBFORMATNAME: _tcscpy_s(MSG_LOOKUP[i], _T("WM_ASKCBFORMATNAME")); break;
|
||||
case WM_CHANGECBCHAIN: _tcscpy_s(MSG_LOOKUP[i], _T("WM_CHANGECBCHAIN")); break;
|
||||
case WM_HSCROLLCLIPBOARD: _tcscpy_s(MSG_LOOKUP[i], _T("WM_HSCROLLCLIPBOARD")); break;
|
||||
case WM_QUERYNEWPALETTE: _tcscpy_s(MSG_LOOKUP[i], _T("WM_QUERYNEWPALETTE")); break;
|
||||
case WM_PALETTEISCHANGING: _tcscpy_s(MSG_LOOKUP[i], _T("WM_PALETTEISCHANGING")); break;
|
||||
case WM_PALETTECHANGED: _tcscpy_s(MSG_LOOKUP[i], _T("WM_PALETTECHANGED")); break;
|
||||
case WM_HOTKEY: _tcscpy_s(MSG_LOOKUP[i], _T("WM_HOTKEY")); break;
|
||||
case WM_PRINT: _tcscpy_s(MSG_LOOKUP[i], _T("WM_PRINT")); break;
|
||||
case WM_PRINTCLIENT: _tcscpy_s(MSG_LOOKUP[i], _T("WM_PRINTCLIENT")); break;
|
||||
case WM_HANDHELDFIRST: _tcscpy_s(MSG_LOOKUP[i], _T("WM_HANDHELDFIRST")); break;
|
||||
case WM_HANDHELDLAST: _tcscpy_s(MSG_LOOKUP[i], _T("WM_HANDHELDLAST")); break;
|
||||
case WM_PENWINFIRST: _tcscpy_s(MSG_LOOKUP[i], _T("WM_PENWINFIRST")); break;
|
||||
case WM_PENWINLAST: _tcscpy_s(MSG_LOOKUP[i], _T("WM_PENWINLAST")); break;
|
||||
case 0x390: _tcscpy_s(MSG_LOOKUP[i], _T("WM_COALESCE_FIRST")); break;
|
||||
case 0x39F: _tcscpy_s(MSG_LOOKUP[i], _T("WM_COALESCE_LAST")); break;
|
||||
case 0x3E0: _tcscpy_s(MSG_LOOKUP[i], _T("WM_DDE_FIRST")); break;
|
||||
//case 0x3E0: _tcscpy_s(MSG_LOOKUP[i], _T("WM_DDE_INITIATE")); break;
|
||||
case 0x3E1: _tcscpy_s(MSG_LOOKUP[i], _T("WM_DDE_TERMINATE")); break;
|
||||
case 0x3E2: _tcscpy_s(MSG_LOOKUP[i], _T("WM_DDE_ADVISE")); break;
|
||||
case 0x3E3: _tcscpy_s(MSG_LOOKUP[i], _T("WM_DDE_UNADVISE")); break;
|
||||
case 0x3E4: _tcscpy_s(MSG_LOOKUP[i], _T("WM_DDE_ACK")); break;
|
||||
case 0x3E5: _tcscpy_s(MSG_LOOKUP[i], _T("WM_DDE_DATA")); break;
|
||||
case 0x3E6: _tcscpy_s(MSG_LOOKUP[i], _T("WM_DDE_REQUEST")); break;
|
||||
case 0x3E7: _tcscpy_s(MSG_LOOKUP[i], _T("WM_DDE_POKE")); break;
|
||||
case 0x3E8: _tcscpy_s(MSG_LOOKUP[i], _T("WM_DDE_EXECUTE")); break;
|
||||
//case 0x3E8: _tcscpy_s(MSG_LOOKUP[i], _T("WM_DDE_LAST")); break;
|
||||
|
||||
//case : _tcscpy_s(MSG_LOOKUP[i], _T("")); break;
|
||||
default:
|
||||
memset((void *)&MSG_LOOKUP[i], '\0', sizeof(TCHAR) * MAX_MSG_NAME);
|
||||
//_tcscpy_s(MSG_LOOKUP[i], 20, _T(""));
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void InitializeMsgLookup()
|
||||
{
|
||||
int allowList[1];
|
||||
allowList[0] = -1;
|
||||
InitializeMsgLookup(allowList, 0);
|
||||
}
|
||||
|
||||
BIN
native/MsgHookTest/MsgHookTest.aps
Normal file
BIN
native/MsgHookTest/MsgHookTest.aps
Normal file
Binary file not shown.
388
native/MsgHookTest/MsgHookTest.cpp
Normal file
388
native/MsgHookTest/MsgHookTest.cpp
Normal file
@@ -0,0 +1,388 @@
|
||||
// MsgHookTest.cpp : Defines the entry point for the application.
|
||||
//
|
||||
|
||||
#include "stdafx.h"
|
||||
#include "MsgHookTest.h"
|
||||
#include "MsgHook.h"
|
||||
|
||||
#define MAX_LOADSTRING 100
|
||||
|
||||
// Global Variables:
|
||||
HINSTANCE hInst; // current instance
|
||||
TCHAR szTitle[MAX_LOADSTRING]; // The title bar text
|
||||
TCHAR szWindowClass[MAX_LOADSTRING]; // the main window class name
|
||||
HWND mainHwnd = NULL;
|
||||
HWND txtbox = NULL;
|
||||
HWND targetHwnd = NULL;
|
||||
//TCHAR targetClassname[100] = _T("Notepad");
|
||||
TCHAR targetClassname[100] = _T("WordPadClass");
|
||||
bool filterWmCommand = true;
|
||||
bool filterWmNotify = false;
|
||||
bool filterAbove = false;
|
||||
|
||||
|
||||
// Forward declarations of functions included in this code module:
|
||||
ATOM MyRegisterClass(HINSTANCE hInstance);
|
||||
BOOL InitInstance(HINSTANCE, int);
|
||||
LRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM);
|
||||
INT_PTR CALLBACK About(HWND, UINT, WPARAM, LPARAM);
|
||||
|
||||
int APIENTRY _tWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPTSTR lpCmdLine, int nCmdShow)
|
||||
{
|
||||
|
||||
UNREFERENCED_PARAMETER(hPrevInstance);
|
||||
UNREFERENCED_PARAMETER(lpCmdLine);
|
||||
|
||||
// TODO: Place code here.
|
||||
MSG msg;
|
||||
HACCEL hAccelTable;
|
||||
|
||||
// Initialize global strings
|
||||
LoadString(hInstance, IDS_APP_TITLE, szTitle, MAX_LOADSTRING);
|
||||
LoadString(hInstance, IDC_MSGHOOKTEST, szWindowClass, MAX_LOADSTRING);
|
||||
MyRegisterClass(hInstance);
|
||||
|
||||
// Perform application initialization:
|
||||
if (!InitInstance (hInstance, nCmdShow))
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
hAccelTable = LoadAccelerators(hInstance, MAKEINTRESOURCE(IDC_MSGHOOKTEST));
|
||||
|
||||
// Main message loop:
|
||||
while (GetMessage(&msg, NULL, 0, 0))
|
||||
{
|
||||
if (!TranslateAccelerator(msg.hwnd, hAccelTable, &msg))
|
||||
{
|
||||
TranslateMessage(&msg);
|
||||
DispatchMessage(&msg);
|
||||
}
|
||||
}
|
||||
|
||||
return (int) msg.wParam;
|
||||
}
|
||||
|
||||
void AppendText(HWND txtHwnd, LPCTSTR newText)
|
||||
{
|
||||
|
||||
DWORD len = GetWindowTextLength(txtHwnd);
|
||||
if (len > 25000)
|
||||
{//need to truncate the beginning so the text doesn't go past it's limit
|
||||
SendMessage(txtHwnd, EM_SETSEL, 0, 10000);
|
||||
SendMessage(txtHwnd, EM_REPLACESEL, 0, (LPARAM)_T(""));
|
||||
len = GetWindowTextLength(txtHwnd);
|
||||
}
|
||||
//DWORD l,r;
|
||||
//SendMessage(txtHwnd, EM_GETSEL,(WPARAM)&l,(LPARAM)&r);
|
||||
SendMessage(txtHwnd, EM_SETSEL, len, len);
|
||||
SendMessage(txtHwnd, EM_REPLACESEL, 0, (LPARAM)newText);
|
||||
len = GetWindowTextLength(txtHwnd);
|
||||
SendMessage(txtHwnd, EM_SETSEL, len, len);
|
||||
//SendMessage(txtHwnd, EM_SETSEL,l,r);
|
||||
}
|
||||
|
||||
void InitMsgFiltersAndLookup()
|
||||
{
|
||||
if (!filterWmCommand && !filterAbove && !filterWmNotify)
|
||||
InitializeMsgLookup();
|
||||
else
|
||||
{
|
||||
int allowList[3];
|
||||
for (int i = 0; i < 3; i ++)
|
||||
allowList[i] = -1;
|
||||
|
||||
if (filterWmCommand) {
|
||||
AppendText(txtbox, _T("filtering on WM_COMMAND & WM_MENUCOMMAND\r\n"));
|
||||
allowList[0] = WM_COMMAND;
|
||||
allowList[1] = WM_MENUCOMMAND;
|
||||
}
|
||||
if (filterWmNotify)
|
||||
{
|
||||
AppendText(txtbox, _T("filtering on WM_NOTIFY\r\n"));
|
||||
allowList[2] = WM_NOTIFY;
|
||||
}
|
||||
//if (filterAbove)
|
||||
// allowList[0] = WM_COMMAND;
|
||||
InitializeMsgLookup(allowList, 3);
|
||||
}
|
||||
}
|
||||
|
||||
void StartMessageHook()
|
||||
{
|
||||
AppendText(txtbox, _T("Starting Message Hook\r\n"));
|
||||
targetHwnd = FindWindow(targetClassname, NULL);
|
||||
DWORD tid = GetWindowThreadProcessId(targetHwnd, NULL);
|
||||
|
||||
InitMsgFiltersAndLookup();
|
||||
//InitializeMsgLookup();
|
||||
|
||||
TCHAR tmp[50];
|
||||
_stprintf_s(tmp, _T("Targetting %ld, %ld\r\n"), targetHwnd, tid);
|
||||
AppendText(txtbox, tmp);
|
||||
|
||||
//block self/global msg hook
|
||||
if (targetHwnd == NULL || tid == 0) {
|
||||
AppendText(txtbox, _T("Target window not found\r\n"));
|
||||
return;
|
||||
}
|
||||
|
||||
if (InitHook(mainHwnd, tid))
|
||||
{
|
||||
AppendText(txtbox, _T("Hook successfully initialized\r\n"));
|
||||
}
|
||||
else
|
||||
AppendText(txtbox, _T("Hook failed to initialize\r\n"));
|
||||
}
|
||||
|
||||
void StopMessageHook()
|
||||
{
|
||||
AppendText(txtbox, TEXT("Stopping Message Hook\r\n"));
|
||||
KillHook();
|
||||
}
|
||||
|
||||
bool OnCopyData(COPYDATASTRUCT* pCopyDataStruct) // WM_COPYDATA lParam will have this struct
|
||||
{
|
||||
if( pCopyDataStruct->cbData!=sizeof(HEVENT))
|
||||
return false;
|
||||
HEVENT Event;
|
||||
memcpy(&Event, (HEVENT*)pCopyDataStruct->lpData, sizeof(HEVENT)); // transfer data to internal variable
|
||||
if (Event.dwHookType == WH_KEYBOARD)
|
||||
{
|
||||
//KBDLLHOOKSTRUCT* pkh = (KBDLLHOOKSTRUCT*) Event.lParam;
|
||||
//char tmp[50];
|
||||
//return wkvn->KeyboardData(pkh->vkCode,Event.wParam);
|
||||
}
|
||||
else if (Event.dwHookType == WH_MOUSE)
|
||||
{
|
||||
//MSLLHOOKSTRUCT* pmh = (MSLLHOOKSTRUCT*) Event.lParam;
|
||||
//char tmp[50];
|
||||
//if (Event.wParam == WM_LBUTTONDOWN)
|
||||
// return wkvn->MouseClickData(1,true);
|
||||
// else
|
||||
// return wkvn->MouseMoveData(pmh->pt.x,pmh->pt.y);
|
||||
}
|
||||
else if (Event.dwHookType == WH_CALLWNDPROC)
|
||||
{
|
||||
TCHAR *msgName = _T("unknown");
|
||||
if (Event.nCode < MAX_MSG_LOOKUP)
|
||||
msgName = MSG_LOOKUP[Event.nCode];
|
||||
else
|
||||
{
|
||||
if (!filterAbove)
|
||||
return false;
|
||||
}
|
||||
if (_tcscmp(msgName, _T("")) != 0)
|
||||
{
|
||||
TCHAR tmp[200];
|
||||
_stprintf_s(tmp, _T("msg: %s (%ld), wparam: %ld, lparam: %ld\r\n"), msgName, Event.nCode, Event.wParam, Event.lParam);
|
||||
AppendText(txtbox, tmp);
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
void SendWmSettext() //ID_TESTMSGS_WM
|
||||
{
|
||||
//SetWindowText(targetHwnd, _T("This is a test"));
|
||||
TCHAR txt[] = _T("This is a test");
|
||||
SendMessage(targetHwnd, WM_SETTEXT, 0 , (LPARAM)txt);
|
||||
//PostMessage(targetHwnd, WM_SETTEXT, 0 , (LPARAM)txt);
|
||||
}
|
||||
|
||||
//
|
||||
// FUNCTION: MyRegisterClass()
|
||||
//
|
||||
// PURPOSE: Registers the window class.
|
||||
//
|
||||
// COMMENTS:
|
||||
//
|
||||
// This function and its usage are only necessary if you want this code
|
||||
// to be compatible with Win32 systems prior to the 'RegisterClassEx'
|
||||
// function that was added to Windows 95. It is important to call this function
|
||||
// so that the application will get 'well formed' small icons associated
|
||||
// with it.
|
||||
//
|
||||
ATOM MyRegisterClass(HINSTANCE hInstance)
|
||||
{
|
||||
WNDCLASSEX wcex;
|
||||
|
||||
wcex.cbSize = sizeof(WNDCLASSEX);
|
||||
|
||||
wcex.style = CS_HREDRAW | CS_VREDRAW;
|
||||
wcex.lpfnWndProc = WndProc;
|
||||
wcex.cbClsExtra = 0;
|
||||
wcex.cbWndExtra = 0;
|
||||
wcex.hInstance = hInstance;
|
||||
wcex.hIcon = LoadIcon(hInstance, MAKEINTRESOURCE(IDI_MSGHOOKTEST));
|
||||
wcex.hCursor = LoadCursor(NULL, IDC_ARROW);
|
||||
wcex.hbrBackground = (HBRUSH)(COLOR_WINDOW+1);
|
||||
wcex.lpszMenuName = MAKEINTRESOURCE(IDC_MSGHOOKTEST);
|
||||
wcex.lpszClassName = szWindowClass;
|
||||
wcex.hIconSm = LoadIcon(wcex.hInstance, MAKEINTRESOURCE(IDI_SMALL));
|
||||
|
||||
return RegisterClassEx(&wcex);
|
||||
}
|
||||
|
||||
//
|
||||
// FUNCTION: InitInstance(HINSTANCE, int)
|
||||
//
|
||||
// PURPOSE: Saves instance handle and creates main window
|
||||
//
|
||||
// COMMENTS:
|
||||
//
|
||||
// In this function, we save the instance handle in a global variable and
|
||||
// create and display the main program window.
|
||||
//
|
||||
BOOL InitInstance(HINSTANCE hInstance, int nCmdShow)
|
||||
{
|
||||
HWND hWnd;
|
||||
|
||||
hInst = hInstance; // Store instance handle in our global variable
|
||||
|
||||
hWnd = CreateWindow(szWindowClass, szTitle, WS_OVERLAPPEDWINDOW,
|
||||
CW_USEDEFAULT, 0, CW_USEDEFAULT, 0, NULL, NULL, hInstance, NULL);
|
||||
|
||||
if (!hWnd)
|
||||
return FALSE;
|
||||
mainHwnd = hWnd;
|
||||
|
||||
RECT rect;
|
||||
GetClientRect(hWnd, &rect);
|
||||
// make the txtbox edit control almost the same size as the parent window
|
||||
//WS_CHILD | WS_VISIBLE | WS_VSCROLL | ES_LEFT | ES_MULTILINE | ES_AUTOVSCROLL
|
||||
txtbox = CreateWindow(TEXT("Edit"),TEXT(""), WS_CHILD | WS_VISIBLE | ES_MULTILINE | WS_VSCROLL | ES_AUTOVSCROLL | ES_READONLY,
|
||||
10, 10,rect.right - 20, rect.bottom - 20, hWnd, NULL, NULL, NULL);
|
||||
|
||||
ShowWindow(hWnd, nCmdShow);
|
||||
UpdateWindow(hWnd);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
//
|
||||
// FUNCTION: WndProc(HWND, UINT, WPARAM, LPARAM)
|
||||
//
|
||||
// PURPOSE: Processes messages for the main window.
|
||||
//
|
||||
// WM_COMMAND - process the application menu
|
||||
// WM_PAINT - Paint the main window
|
||||
// WM_DESTROY - post a quit message and return
|
||||
//
|
||||
//
|
||||
LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
int wmId, wmEvent;
|
||||
PAINTSTRUCT ps;
|
||||
HDC hdc;
|
||||
|
||||
switch (message)
|
||||
{
|
||||
case WM_CREATE:
|
||||
//appendText(txtbox, TEXT("test\r\n"));
|
||||
break;
|
||||
case WM_COPYDATA:
|
||||
return (OnCopyData((COPYDATASTRUCT *) lParam));
|
||||
break;
|
||||
case WM_COMMAND:
|
||||
wmId = LOWORD(wParam);
|
||||
wmEvent = HIWORD(wParam);
|
||||
// Parse the menu selections:
|
||||
switch (wmId)
|
||||
{
|
||||
case ID_FILE_STARTHOOK:
|
||||
StartMessageHook();
|
||||
break;
|
||||
case ID_FILE_STOPHOOK:
|
||||
StopMessageHook();
|
||||
break;
|
||||
case ID_TESTMSGS_WM:
|
||||
SendWmSettext();
|
||||
break;
|
||||
case ID_FILE_SETTINGS:
|
||||
DialogBox(hInst, MAKEINTRESOURCE(IDD_DIALOG1), hWnd, About);
|
||||
break;
|
||||
case IDM_ABOUT:
|
||||
DialogBox(hInst, MAKEINTRESOURCE(IDD_ABOUTBOX), hWnd, About);
|
||||
break;
|
||||
case IDM_EXIT:
|
||||
DestroyWindow(hWnd);
|
||||
break;
|
||||
default:
|
||||
return DefWindowProc(hWnd, message, wParam, lParam);
|
||||
}
|
||||
break;
|
||||
case WM_PAINT:
|
||||
hdc = BeginPaint(hWnd, &ps);
|
||||
// TODO: Add any drawing code here...
|
||||
EndPaint(hWnd, &ps);
|
||||
break;
|
||||
case WM_SIZE:
|
||||
{ //resize the txtbox when the parent window size changes
|
||||
int nWidth = LOWORD(lParam);
|
||||
int nHeight = HIWORD(lParam);
|
||||
SetWindowPos(txtbox, HWND_NOTOPMOST, 10, 10, nWidth-20, nHeight-20, SWP_NOZORDER|SWP_NOMOVE);
|
||||
}
|
||||
break;
|
||||
case WM_DESTROY:
|
||||
PostQuitMessage(0);
|
||||
break;
|
||||
default:
|
||||
return DefWindowProc(hWnd, message, wParam, lParam);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
// Message handler for about box.
|
||||
INT_PTR CALLBACK About(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
UNREFERENCED_PARAMETER(lParam);
|
||||
switch (message)
|
||||
{
|
||||
case WM_INITDIALOG:
|
||||
{
|
||||
//IDC_EDIT1
|
||||
HWND classnameHwnd = GetDlgItem(hDlg, IDC_EDIT1);
|
||||
if (classnameHwnd != NULL)
|
||||
SetWindowText(classnameHwnd, targetClassname);
|
||||
|
||||
if (filterWmCommand)
|
||||
SendDlgItemMessage(hDlg, IDC_CHECK_CMD, BM_SETCHECK, BST_CHECKED, 0);
|
||||
if (filterWmNotify)
|
||||
SendDlgItemMessage(hDlg, IDC_CHECK_NOT, BM_SETCHECK, BST_CHECKED, 0);
|
||||
if (filterAbove)
|
||||
SendDlgItemMessage(hDlg, IDC_CHECK_ABO, BM_SETCHECK, BST_CHECKED, 0);
|
||||
|
||||
}
|
||||
return (INT_PTR)TRUE;
|
||||
|
||||
case WM_COMMAND:
|
||||
if (LOWORD(wParam) == IDOK) //only save on OK
|
||||
{
|
||||
HWND classnameHwnd = GetDlgItem(hDlg, IDC_EDIT1);
|
||||
if (classnameHwnd != NULL)
|
||||
GetWindowText(classnameHwnd, targetClassname, 100);
|
||||
// check filter options
|
||||
if (SendDlgItemMessage(hDlg, IDC_CHECK_CMD, BM_GETCHECK, 0, 0) == BST_CHECKED) // the hard way
|
||||
filterWmCommand = true;
|
||||
else
|
||||
filterWmCommand = false;
|
||||
if (IsDlgButtonChecked(hDlg, IDC_CHECK_NOT) == BST_CHECKED) // the easy way
|
||||
filterWmNotify = true;
|
||||
else
|
||||
filterWmNotify = false;
|
||||
if (IsDlgButtonChecked(hDlg, IDC_CHECK_ABO) == BST_CHECKED)
|
||||
filterAbove = true;
|
||||
else
|
||||
filterAbove = false;
|
||||
InitMsgFiltersAndLookup();
|
||||
}
|
||||
if (LOWORD(wParam) == IDOK || LOWORD(wParam) == IDCANCEL)
|
||||
{
|
||||
EndDialog(hDlg, LOWORD(wParam));
|
||||
return (INT_PTR)TRUE;
|
||||
}
|
||||
break;
|
||||
}
|
||||
return (INT_PTR)FALSE;
|
||||
}
|
||||
3
native/MsgHookTest/MsgHookTest.h
Normal file
3
native/MsgHookTest/MsgHookTest.h
Normal file
@@ -0,0 +1,3 @@
|
||||
#pragma once
|
||||
|
||||
#include "resource.h"
|
||||
BIN
native/MsgHookTest/MsgHookTest.ico
Normal file
BIN
native/MsgHookTest/MsgHookTest.ico
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 23 KiB |
BIN
native/MsgHookTest/MsgHookTest.rc
Normal file
BIN
native/MsgHookTest/MsgHookTest.rc
Normal file
Binary file not shown.
166
native/MsgHookTest/MsgHookTest.vcxproj
Normal file
166
native/MsgHookTest/MsgHookTest.vcxproj
Normal file
@@ -0,0 +1,166 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="Debug|Win32">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Debug|x64">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|Win32">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|x64">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
</ItemGroup>
|
||||
<PropertyGroup Label="Globals">
|
||||
<ProjectGuid>{E8016236-E771-4BEC-8407-6BF37C68D174}</ProjectGuid>
|
||||
<Keyword>Win32Proj</Keyword>
|
||||
<RootNamespace>MsgHookTest</RootNamespace>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<ImportGroup Label="ExtensionSettings">
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<PropertyGroup Label="UserMacros" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<LinkIncremental>true</LinkIncremental>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<LinkIncremental>true</LinkIncremental>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<LinkIncremental>false</LinkIncremental>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<LinkIncremental>false</LinkIncremental>
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<ClCompile>
|
||||
<PrecompiledHeader>Use</PrecompiledHeader>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<ClCompile>
|
||||
<PrecompiledHeader>Use</PrecompiledHeader>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<PrecompiledHeader>Use</PrecompiledHeader>
|
||||
<Optimization>MaxSpeed</Optimization>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<PrecompiledHeader>Use</PrecompiledHeader>
|
||||
<Optimization>MaxSpeed</Optimization>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<None Include="MsgHookTest.ico" />
|
||||
<None Include="ReadMe.txt" />
|
||||
<None Include="small.ico" />
|
||||
<None Include="WinMessages.txt" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="MsgHook.h" />
|
||||
<ClInclude Include="MsgHookTest.h" />
|
||||
<ClInclude Include="Resource.h" />
|
||||
<ClInclude Include="stdafx.h" />
|
||||
<ClInclude Include="targetver.h" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="MsgHookTest.cpp" />
|
||||
<ClCompile Include="stdafx.cpp">
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Create</PrecompiledHeader>
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Create</PrecompiledHeader>
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Create</PrecompiledHeader>
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Create</PrecompiledHeader>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ResourceCompile Include="MsgHookTest.rc" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\MsgHook\MsgHook.vcxproj">
|
||||
<Project>{8e038a94-7d02-49e9-b9f6-5224d9d11225}</Project>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
</Project>
|
||||
57
native/MsgHookTest/MsgHookTest.vcxproj.filters
Normal file
57
native/MsgHookTest/MsgHookTest.vcxproj.filters
Normal file
@@ -0,0 +1,57 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup>
|
||||
<Filter Include="Source Files">
|
||||
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
|
||||
<Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
|
||||
</Filter>
|
||||
<Filter Include="Header Files">
|
||||
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
|
||||
<Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions>
|
||||
</Filter>
|
||||
<Filter Include="Resource Files">
|
||||
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
|
||||
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
|
||||
</Filter>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="ReadMe.txt" />
|
||||
<None Include="small.ico">
|
||||
<Filter>Resource Files</Filter>
|
||||
</None>
|
||||
<None Include="MsgHookTest.ico">
|
||||
<Filter>Resource Files</Filter>
|
||||
</None>
|
||||
<None Include="WinMessages.txt" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="stdafx.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="targetver.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Resource.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="MsgHookTest.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="MsgHook.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="stdafx.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="MsgHookTest.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ResourceCompile Include="MsgHookTest.rc">
|
||||
<Filter>Resource Files</Filter>
|
||||
</ResourceCompile>
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
3
native/MsgHookTest/MsgHookTest.vcxproj.user
Normal file
3
native/MsgHookTest/MsgHookTest.vcxproj.user
Normal file
@@ -0,0 +1,3 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
</Project>
|
||||
62
native/MsgHookTest/ReadMe.txt
Normal file
62
native/MsgHookTest/ReadMe.txt
Normal file
@@ -0,0 +1,62 @@
|
||||
========================================================================
|
||||
WIN32 APPLICATION : MsgHookTest Project Overview
|
||||
========================================================================
|
||||
|
||||
AppWizard has created this MsgHookTest application for you.
|
||||
|
||||
This file contains a summary of what you will find in each of the files that
|
||||
make up your MsgHookTest application.
|
||||
|
||||
|
||||
MsgHookTest.vcxproj
|
||||
This is the main project file for VC++ projects generated using an Application Wizard.
|
||||
It contains information about the version of Visual C++ that generated the file, and
|
||||
information about the platforms, configurations, and project features selected with the
|
||||
Application Wizard.
|
||||
|
||||
MsgHookTest.vcxproj.filters
|
||||
This is the filters file for VC++ projects generated using an Application Wizard.
|
||||
It contains information about the association between the files in your project
|
||||
and the filters. This association is used in the IDE to show grouping of files with
|
||||
similar extensions under a specific node (for e.g. ".cpp" files are associated with the
|
||||
"Source Files" filter).
|
||||
|
||||
MsgHookTest.cpp
|
||||
This is the main application source file.
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
AppWizard has created the following resources:
|
||||
|
||||
MsgHookTest.rc
|
||||
This is a listing of all of the Microsoft Windows resources that the
|
||||
program uses. It includes the icons, bitmaps, and cursors that are stored
|
||||
in the RES subdirectory. This file can be directly edited in Microsoft
|
||||
Visual C++.
|
||||
|
||||
Resource.h
|
||||
This is the standard header file, which defines new resource IDs.
|
||||
Microsoft Visual C++ reads and updates this file.
|
||||
|
||||
MsgHookTest.ico
|
||||
This is an icon file, which is used as the application's icon (32x32).
|
||||
This icon is included by the main resource file MsgHookTest.rc.
|
||||
|
||||
small.ico
|
||||
This is an icon file, which contains a smaller version (16x16)
|
||||
of the application's icon. This icon is included by the main resource
|
||||
file MsgHookTest.rc.
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
Other standard files:
|
||||
|
||||
StdAfx.h, StdAfx.cpp
|
||||
These files are used to build a precompiled header (PCH) file
|
||||
named MsgHookTest.pch and a precompiled types file named StdAfx.obj.
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
Other notes:
|
||||
|
||||
AppWizard uses "TODO:" comments to indicate parts of the source code you
|
||||
should add to or customize.
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
416
native/MsgHookTest/WinMessages.txt
Normal file
416
native/MsgHookTest/WinMessages.txt
Normal file
@@ -0,0 +1,416 @@
|
||||
|
||||
WM_NULL = 0x00
|
||||
WM_CREATE = 0x01
|
||||
WM_DESTROY = 0x02
|
||||
WM_MOVE = 0x03
|
||||
WM_SIZE = 0x05
|
||||
WM_ACTIVATE = 0x06
|
||||
WM_SETFOCUS = 0x07
|
||||
WM_KILLFOCUS = 0x08
|
||||
WM_ENABLE = 0x0A
|
||||
WM_SETREDRAW = 0x0B
|
||||
WM_SETTEXT = 0x0C
|
||||
WM_GETTEXT = 0x0D
|
||||
WM_GETTEXTLENGTH = 0x0E
|
||||
WM_PAINT = 0x0F
|
||||
WM_CLOSE = 0x10
|
||||
WM_QUERYENDSESSION = 0x11
|
||||
WM_QUIT = 0x12
|
||||
WM_QUERYOPEN = 0x13
|
||||
WM_ERASEBKGND = 0x14
|
||||
WM_SYSCOLORCHANGE = 0x15
|
||||
WM_ENDSESSION = 0x16
|
||||
WM_SYSTEMERROR = 0x17
|
||||
WM_SHOWWINDOW = 0x18
|
||||
WM_CTLCOLOR = 0x19
|
||||
WM_WININICHANGE = 0x1A
|
||||
WM_SETTINGCHANGE = 0x1A
|
||||
WM_DEVMODECHANGE = 0x1B
|
||||
WM_ACTIVATEAPP = 0x1C
|
||||
WM_FONTCHANGE = 0x1D
|
||||
WM_TIMECHANGE = 0x1E
|
||||
WM_CANCELMODE = 0x1F
|
||||
WM_SETCURSOR = 0x20
|
||||
WM_MOUSEACTIVATE = 0x21
|
||||
WM_CHILDACTIVATE = 0x22
|
||||
WM_QUEUESYNC = 0x23
|
||||
WM_GETMINMAXINFO = 0x24
|
||||
WM_PAINTICON = 0x26
|
||||
WM_ICONERASEBKGND = 0x27
|
||||
WM_NEXTDLGCTL = 0x28
|
||||
WM_SPOOLERSTATUS = 0x2A
|
||||
WM_DRAWITEM = 0x2B
|
||||
WM_MEASUREITEM = 0x2C
|
||||
WM_DELETEITEM = 0x2D
|
||||
WM_VKEYTOITEM = 0x2E
|
||||
WM_CHARTOITEM = 0x2F
|
||||
WM_SETFONT = 0x30
|
||||
WM_GETFONT = 0x31
|
||||
WM_SETHOTKEY = 0x32
|
||||
WM_GETHOTKEY = 0x33
|
||||
WM_QUERYDRAGICON = 0x37
|
||||
WM_COMPAREITEM = 0x39
|
||||
WM_COMPACTING = 0x41
|
||||
WM_WINDOWPOSCHANGING = 0x46
|
||||
WM_WINDOWPOSCHANGED = 0x47
|
||||
WM_POWER = 0x48
|
||||
WM_COPYDATA = 0x4A
|
||||
WM_CANCELJOURNAL = 0x4B
|
||||
WM_NOTIFY = 0x4E
|
||||
WM_INPUTLANGCHANGEREQUEST = 0x50
|
||||
WM_INPUTLANGCHANGE = 0x51
|
||||
WM_TCARD = 0x52
|
||||
WM_HELP = 0x53
|
||||
WM_USERCHANGED = 0x54
|
||||
WM_NOTIFYFORMAT = 0x55
|
||||
WM_CONTEXTMENU = 0x7B
|
||||
WM_STYLECHANGING = 0x7C
|
||||
WM_STYLECHANGED = 0x7D
|
||||
WM_DISPLAYCHANGE = 0x7E
|
||||
WM_GETICON = 0x7F
|
||||
WM_SETICON = 0x80
|
||||
WM_NCCREATE = 0x81
|
||||
WM_NCDESTROY = 0x82
|
||||
WM_NCCALCSIZE = 0x83
|
||||
WM_NCHITTEST = 0x84
|
||||
WM_NCPAINT = 0x85
|
||||
WM_NCACTIVATE = 0x86
|
||||
WM_GETDLGCODE = 0x87
|
||||
WM_NCMOUSEMOVE = 0xA0
|
||||
WM_NCLBUTTONDOWN = 0xA1
|
||||
WM_NCLBUTTONUP = 0xA2
|
||||
WM_NCLBUTTONDBLCLK = 0xA3
|
||||
WM_NCRBUTTONDOWN = 0xA4
|
||||
WM_NCRBUTTONUP = 0xA5
|
||||
WM_NCRBUTTONDBLCLK = 0xA6
|
||||
WM_NCMBUTTONDOWN = 0xA7
|
||||
WM_NCMBUTTONUP = 0xA8
|
||||
WM_NCMBUTTONDBLCLK = 0xA9
|
||||
WM_KEYFIRST = 0x100
|
||||
WM_KEYDOWN = 0x100
|
||||
WM_KEYUP = 0x101
|
||||
WM_CHAR = 0x102
|
||||
WM_DEADCHAR = 0x103
|
||||
WM_SYSKEYDOWN = 0x104
|
||||
WM_SYSKEYUP = 0x105
|
||||
WM_SYSCHAR = 0x106
|
||||
WM_SYSDEADCHAR = 0x107
|
||||
WM_KEYLAST = 0x108
|
||||
WM_IME_STARTCOMPOSITION = 0x10D
|
||||
WM_IME_ENDCOMPOSITION = 0x10E
|
||||
WM_IME_COMPOSITION = 0x10F
|
||||
WM_IME_KEYLAST = 0x10F
|
||||
WM_INITDIALOG = 0x110
|
||||
WM_COMMAND = 0x111
|
||||
WM_SYSCOMMAND = 0x112
|
||||
WM_TIMER = 0x113
|
||||
WM_HSCROLL = 0x114
|
||||
WM_VSCROLL = 0x115
|
||||
WM_INITMENU = 0x116
|
||||
WM_INITMENUPOPUP = 0x117
|
||||
WM_MENUSELECT = 0x11F
|
||||
WM_MENUCHAR = 0x120
|
||||
WM_ENTERIDLE = 0x121
|
||||
WM_CTLCOLORMSGBOX = 0x132
|
||||
WM_CTLCOLOREDIT = 0x133
|
||||
WM_CTLCOLORLISTBOX = 0x134
|
||||
WM_CTLCOLORBTN = 0x135
|
||||
WM_CTLCOLORDLG = 0x136
|
||||
WM_CTLCOLORSCROLLBAR = 0x137
|
||||
WM_CTLCOLORSTATIC = 0x138
|
||||
WM_MOUSEFIRST = 0x200
|
||||
WM_MOUSEMOVE = 0x200
|
||||
WM_LBUTTONDOWN = 0x201
|
||||
WM_LBUTTONUP = 0x202
|
||||
WM_LBUTTONDBLCLK = 0x203
|
||||
WM_RBUTTONDOWN = 0x204
|
||||
WM_RBUTTONUP = 0x205
|
||||
WM_RBUTTONDBLCLK = 0x206
|
||||
WM_MBUTTONDOWN = 0x207
|
||||
WM_MBUTTONUP = 0x208
|
||||
WM_MBUTTONDBLCLK = 0x209
|
||||
WM_MOUSEWHEEL = 0x20A
|
||||
WM_MOUSEHWHEEL = 0x20E
|
||||
WM_PARENTNOTIFY = 0x210
|
||||
WM_ENTERMENULOOP = 0x211
|
||||
WM_EXITMENULOOP = 0x212
|
||||
WM_NEXTMENU = 0x213
|
||||
WM_SIZING = 0x214
|
||||
WM_CAPTURECHANGED = 0x215
|
||||
WM_MOVING = 0x216
|
||||
WM_POWERBROADCAST = 0x218
|
||||
WM_DEVICECHANGE = 0x219
|
||||
WM_MDICREATE = 0x220
|
||||
WM_MDIDESTROY = 0x221
|
||||
WM_MDIACTIVATE = 0x222
|
||||
WM_MDIRESTORE = 0x223
|
||||
WM_MDINEXT = 0x224
|
||||
WM_MDIMAXIMIZE = 0x225
|
||||
WM_MDITILE = 0x226
|
||||
WM_MDICASCADE = 0x227
|
||||
WM_MDIICONARRANGE = 0x228
|
||||
WM_MDIGETACTIVE = 0x229
|
||||
WM_MDISETMENU = 0x230
|
||||
WM_ENTERSIZEMOVE = 0x231
|
||||
WM_EXITSIZEMOVE = 0x232
|
||||
WM_DROPFILES = 0x233
|
||||
WM_MDIREFRESHMENU = 0x234
|
||||
WM_IME_SETCONTEXT = 0x281
|
||||
WM_IME_NOTIFY = 0x282
|
||||
WM_IME_CONTROL = 0x283
|
||||
WM_IME_COMPOSITIONFULL = 0x284
|
||||
WM_IME_SELECT = 0x285
|
||||
WM_IME_CHAR = 0x286
|
||||
WM_IME_KEYDOWN = 0x290
|
||||
WM_IME_KEYUP = 0x291
|
||||
WM_MOUSEHOVER = 0x2A1
|
||||
WM_NCMOUSELEAVE = 0x2A2
|
||||
WM_MOUSELEAVE = 0x2A3
|
||||
WM_CUT = 0x300
|
||||
WM_COPY = 0x301
|
||||
WM_PASTE = 0x302
|
||||
WM_CLEAR = 0x303
|
||||
WM_UNDO = 0x304
|
||||
WM_RENDERFORMAT = 0x305
|
||||
WM_RENDERALLFORMATS = 0x306
|
||||
WM_DESTROYCLIPBOARD = 0x307
|
||||
WM_DRAWCLIPBOARD = 0x308
|
||||
WM_PAINTCLIPBOARD = 0x309
|
||||
WM_VSCROLLCLIPBOARD = 0x30A
|
||||
WM_SIZECLIPBOARD = 0x30B
|
||||
WM_ASKCBFORMATNAME = 0x30C
|
||||
WM_CHANGECBCHAIN = 0x30D
|
||||
WM_HSCROLLCLIPBOARD = 0x30E
|
||||
WM_QUERYNEWPALETTE = 0x30F
|
||||
WM_PALETTEISCHANGING = 0x310
|
||||
WM_PALETTECHANGED = 0x311
|
||||
WM_HOTKEY = 0x312
|
||||
WM_PRINT = 0x317
|
||||
WM_PRINTCLIENT = 0x318
|
||||
WM_HANDHELDFIRST = 0x358
|
||||
WM_HANDHELDLAST = 0x35F
|
||||
WM_PENWINFIRST = 0x380
|
||||
WM_PENWINLAST = 0x38F
|
||||
WM_COALESCE_FIRST = 0x390
|
||||
WM_COALESCE_LAST = 0x39F
|
||||
WM_DDE_FIRST = 0x3E0
|
||||
WM_DDE_INITIATE = 0x3E0
|
||||
WM_DDE_TERMINATE = 0x3E1
|
||||
WM_DDE_ADVISE = 0x3E2
|
||||
WM_DDE_UNADVISE = 0x3E3
|
||||
WM_DDE_ACK = 0x3E4
|
||||
WM_DDE_DATA = 0x3E5
|
||||
WM_DDE_REQUEST = 0x3E6
|
||||
WM_DDE_POKE = 0x3E7
|
||||
WM_DDE_EXECUTE = 0x3E8
|
||||
WM_DDE_LAST = 0x3E8
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
WM_NULL
|
||||
WM_CREATE
|
||||
WM_DESTROY
|
||||
WM_MOVE
|
||||
WM_SIZE
|
||||
WM_ACTIVATE
|
||||
WM_SETFOCUS
|
||||
WM_KILLFOCUS
|
||||
WM_ENABLE
|
||||
WM_SETREDRAW
|
||||
WM_SETTEXT
|
||||
WM_GETTEXT
|
||||
WM_GETTEXTLENGTH
|
||||
WM_PAINT
|
||||
WM_CLOSE
|
||||
WM_QUERYENDSESSION
|
||||
WM_QUIT
|
||||
WM_QUERYOPEN
|
||||
WM_ERASEBKGND
|
||||
WM_SYSCOLORCHANGE
|
||||
WM_ENDSESSION
|
||||
WM_SYSTEMERROR
|
||||
WM_SHOWWINDOW
|
||||
WM_CTLCOLOR
|
||||
WM_WININICHANGE
|
||||
WM_SETTINGCHANGE
|
||||
WM_DEVMODECHANGE
|
||||
WM_ACTIVATEAPP
|
||||
WM_FONTCHANGE
|
||||
WM_TIMECHANGE
|
||||
WM_CANCELMODE
|
||||
WM_SETCURSOR
|
||||
WM_MOUSEACTIVATE
|
||||
WM_CHILDACTIVATE
|
||||
WM_QUEUESYNC
|
||||
WM_GETMINMAXINFO
|
||||
WM_PAINTICON
|
||||
WM_ICONERASEBKGND
|
||||
WM_NEXTDLGCTL
|
||||
WM_SPOOLERSTATUS
|
||||
WM_DRAWITEM
|
||||
WM_MEASUREITEM
|
||||
WM_DELETEITEM
|
||||
WM_VKEYTOITEM
|
||||
WM_CHARTOITEM
|
||||
WM_SETFONT
|
||||
WM_GETFONT
|
||||
WM_SETHOTKEY
|
||||
WM_GETHOTKEY
|
||||
WM_QUERYDRAGICON
|
||||
WM_COMPAREITEM
|
||||
WM_COMPACTING
|
||||
WM_WINDOWPOSCHANGING
|
||||
WM_WINDOWPOSCHANGED
|
||||
WM_POWER
|
||||
WM_COPYDATA
|
||||
WM_CANCELJOURNAL
|
||||
WM_NOTIFY
|
||||
WM_INPUTLANGCHANGEREQUEST
|
||||
WM_INPUTLANGCHANGE
|
||||
WM_TCARD
|
||||
WM_HELP
|
||||
WM_USERCHANGED
|
||||
WM_NOTIFYFORMAT
|
||||
WM_CONTEXTMENU
|
||||
WM_STYLECHANGING
|
||||
WM_STYLECHANGED
|
||||
WM_DISPLAYCHANGE
|
||||
WM_GETICON
|
||||
WM_SETICON
|
||||
WM_NCCREATE
|
||||
WM_NCDESTROY
|
||||
WM_NCCALCSIZE
|
||||
WM_NCHITTEST
|
||||
WM_NCPAINT
|
||||
WM_NCACTIVATE
|
||||
WM_GETDLGCODE
|
||||
WM_NCMOUSEMOVE
|
||||
WM_NCLBUTTONDOWN
|
||||
WM_NCLBUTTONUP
|
||||
WM_NCLBUTTONDBLCLK
|
||||
WM_NCRBUTTONDOWN
|
||||
WM_NCRBUTTONUP
|
||||
WM_NCRBUTTONDBLCLK
|
||||
WM_NCMBUTTONDOWN
|
||||
WM_NCMBUTTONUP
|
||||
WM_NCMBUTTONDBLCLK
|
||||
WM_KEYFIRST
|
||||
WM_KEYDOWN
|
||||
WM_KEYUP
|
||||
WM_CHAR
|
||||
WM_DEADCHAR
|
||||
WM_SYSKEYDOWN
|
||||
WM_SYSKEYUP
|
||||
WM_SYSCHAR
|
||||
WM_SYSDEADCHAR
|
||||
WM_KEYLAST
|
||||
WM_IME_STARTCOMPOSITION
|
||||
WM_IME_ENDCOMPOSITION
|
||||
WM_IME_COMPOSITION
|
||||
WM_IME_KEYLAST
|
||||
WM_INITDIALOG
|
||||
WM_COMMAND
|
||||
WM_SYSCOMMAND
|
||||
WM_TIMER
|
||||
WM_HSCROLL
|
||||
WM_VSCROLL
|
||||
WM_INITMENU
|
||||
WM_INITMENUPOPUP
|
||||
WM_MENUSELECT
|
||||
WM_MENUCHAR
|
||||
WM_ENTERIDLE
|
||||
WM_CTLCOLORMSGBOX
|
||||
WM_CTLCOLOREDIT
|
||||
WM_CTLCOLORLISTBOX
|
||||
WM_CTLCOLORBTN
|
||||
WM_CTLCOLORDLG
|
||||
WM_CTLCOLORSCROLLBAR
|
||||
WM_CTLCOLORSTATIC
|
||||
WM_MOUSEFIRST
|
||||
WM_MOUSEMOVE
|
||||
WM_LBUTTONDOWN
|
||||
WM_LBUTTONUP
|
||||
WM_LBUTTONDBLCLK
|
||||
WM_RBUTTONDOWN
|
||||
WM_RBUTTONUP
|
||||
WM_RBUTTONDBLCLK
|
||||
WM_MBUTTONDOWN
|
||||
WM_MBUTTONUP
|
||||
WM_MBUTTONDBLCLK
|
||||
WM_MOUSEWHEEL
|
||||
WM_MOUSEHWHEEL
|
||||
WM_PARENTNOTIFY
|
||||
WM_ENTERMENULOOP
|
||||
WM_EXITMENULOOP
|
||||
WM_NEXTMENU
|
||||
WM_SIZING
|
||||
WM_CAPTURECHANGED
|
||||
WM_MOVING
|
||||
WM_POWERBROADCAST
|
||||
WM_DEVICECHANGE
|
||||
WM_MDICREATE
|
||||
WM_MDIDESTROY
|
||||
WM_MDIACTIVATE
|
||||
WM_MDIRESTORE
|
||||
WM_MDINEXT
|
||||
WM_MDIMAXIMIZE
|
||||
WM_MDITILE
|
||||
WM_MDICASCADE
|
||||
WM_MDIICONARRANGE
|
||||
WM_MDIGETACTIVE
|
||||
WM_MDISETMENU
|
||||
WM_ENTERSIZEMOVE
|
||||
WM_EXITSIZEMOVE
|
||||
WM_DROPFILES
|
||||
WM_MDIREFRESHMENU
|
||||
WM_IME_SETCONTEXT
|
||||
WM_IME_NOTIFY
|
||||
WM_IME_CONTROL
|
||||
WM_IME_COMPOSITIONFULL
|
||||
WM_IME_SELECT
|
||||
WM_IME_CHAR
|
||||
WM_IME_KEYDOWN
|
||||
WM_IME_KEYUP
|
||||
WM_MOUSEHOVER
|
||||
WM_NCMOUSELEAVE
|
||||
WM_MOUSELEAVE
|
||||
WM_CUT
|
||||
WM_COPY
|
||||
WM_PASTE
|
||||
WM_CLEAR
|
||||
WM_UNDO
|
||||
WM_RENDERFORMAT
|
||||
WM_RENDERALLFORMATS
|
||||
WM_DESTROYCLIPBOARD
|
||||
WM_DRAWCLIPBOARD
|
||||
WM_PAINTCLIPBOARD
|
||||
WM_VSCROLLCLIPBOARD
|
||||
WM_SIZECLIPBOARD
|
||||
WM_ASKCBFORMATNAME
|
||||
WM_CHANGECBCHAIN
|
||||
WM_HSCROLLCLIPBOARD
|
||||
WM_QUERYNEWPALETTE
|
||||
WM_PALETTEISCHANGING
|
||||
WM_PALETTECHANGED
|
||||
WM_HOTKEY
|
||||
WM_PRINT
|
||||
WM_PRINTCLIENT
|
||||
WM_HANDHELDFIRST
|
||||
WM_HANDHELDLAST
|
||||
WM_PENWINFIRST
|
||||
WM_PENWINLAST
|
||||
WM_COALESCE_FIRST
|
||||
WM_COALESCE_LAST
|
||||
WM_DDE_FIRST
|
||||
WM_DDE_INITIATE
|
||||
WM_DDE_TERMINATE
|
||||
WM_DDE_ADVISE
|
||||
WM_DDE_UNADVISE
|
||||
WM_DDE_ACK
|
||||
WM_DDE_DATA
|
||||
WM_DDE_REQUEST
|
||||
WM_DDE_POKE
|
||||
WM_DDE_EXECUTE
|
||||
WM_DDE_LAST
|
||||
BIN
native/MsgHookTest/bin/x32/MsgHook.dll
Normal file
BIN
native/MsgHookTest/bin/x32/MsgHook.dll
Normal file
Binary file not shown.
BIN
native/MsgHookTest/bin/x32/MsgHook.exp
Normal file
BIN
native/MsgHookTest/bin/x32/MsgHook.exp
Normal file
Binary file not shown.
BIN
native/MsgHookTest/bin/x32/MsgHook.lib
Normal file
BIN
native/MsgHookTest/bin/x32/MsgHook.lib
Normal file
Binary file not shown.
BIN
native/MsgHookTest/bin/x32/MsgHookTest.exe
Normal file
BIN
native/MsgHookTest/bin/x32/MsgHookTest.exe
Normal file
Binary file not shown.
BIN
native/MsgHookTest/bin/x64/MsgHook.dll
Normal file
BIN
native/MsgHookTest/bin/x64/MsgHook.dll
Normal file
Binary file not shown.
BIN
native/MsgHookTest/bin/x64/MsgHook.exp
Normal file
BIN
native/MsgHookTest/bin/x64/MsgHook.exp
Normal file
Binary file not shown.
BIN
native/MsgHookTest/bin/x64/MsgHook.lib
Normal file
BIN
native/MsgHookTest/bin/x64/MsgHook.lib
Normal file
Binary file not shown.
BIN
native/MsgHookTest/bin/x64/MsgHookTest.exe
Normal file
BIN
native/MsgHookTest/bin/x64/MsgHookTest.exe
Normal file
Binary file not shown.
BIN
native/MsgHookTest/resource.h
Normal file
BIN
native/MsgHookTest/resource.h
Normal file
Binary file not shown.
BIN
native/MsgHookTest/small.ico
Normal file
BIN
native/MsgHookTest/small.ico
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 23 KiB |
8
native/MsgHookTest/stdafx.cpp
Normal file
8
native/MsgHookTest/stdafx.cpp
Normal file
@@ -0,0 +1,8 @@
|
||||
// stdafx.cpp : source file that includes just the standard includes
|
||||
// MsgHookTest.pch will be the pre-compiled header
|
||||
// stdafx.obj will contain the pre-compiled type information
|
||||
|
||||
#include "stdafx.h"
|
||||
|
||||
// TODO: reference any additional headers you need in STDAFX.H
|
||||
// and not in this file
|
||||
23
native/MsgHookTest/stdafx.h
Normal file
23
native/MsgHookTest/stdafx.h
Normal file
@@ -0,0 +1,23 @@
|
||||
// stdafx.h : include file for standard system include files,
|
||||
// or project specific include files that are used frequently, but
|
||||
// are changed infrequently
|
||||
//
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "targetver.h"
|
||||
|
||||
#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
|
||||
// Windows Header Files:
|
||||
#include <windows.h>
|
||||
|
||||
// C RunTime Header Files
|
||||
#include <stdlib.h>
|
||||
#include <malloc.h>
|
||||
#include <memory.h>
|
||||
#include <tchar.h>
|
||||
#include <stdio.h>
|
||||
#include <conio.h>
|
||||
|
||||
|
||||
// TODO: reference additional headers your program requires here
|
||||
8
native/MsgHookTest/targetver.h
Normal file
8
native/MsgHookTest/targetver.h
Normal file
@@ -0,0 +1,8 @@
|
||||
#pragma once
|
||||
|
||||
// Including SDKDDKVer.h defines the highest available Windows platform.
|
||||
|
||||
// If you wish to build your application for a previous Windows platform, include WinSDKVer.h and
|
||||
// set the _WIN32_WINNT macro to the platform you wish to support before including SDKDDKVer.h.
|
||||
|
||||
#include <SDKDDKVer.h>
|
||||
Reference in New Issue
Block a user