type
PMSDLLHookInfo = ^TMSDLLHookInfo;
tagMSDLLHOOKSTRUCT =
packed record
POINT : TPoint;
Handle : DWORD;
wHitTestCode: integer;
dwExtraInfo : DWORD;
end;
TMSDLLHookInfo = tagMSDLLHOOKSTRUCT;
var HookMaus : HHook;
var hApp : HWND;
function MouseHookProc(Code: Integer; wParam: WPARAM; lParam: LPARAM): LRESULT;
stdcall;
const WM_XBUTTONDOWN = $020B;
const WM_XBUTTONUP = $020C;
const WM_XBUTTONDBLCLK = $020D;
var Wnd : HWND;
var PID : DWord;
var TID : DWord;
var mVKCode : integer;
var mUpDown : integer;
var XKord : integer;
var YKord : integer;
var woHit :
string;
var wasHit :
string;
begin
if (Code = HC_ACTION)
and (wParam <> WM_MOUSEMOVE)
and (wParam <> WM_NCMOUSEMOVE)
then
begin
Wnd := GetForeGroundWindow;
TID := GetWindowThreadProcessId(Wnd, PID);
MUpDown := wParam;
case wParam
of
WM_LBUTTONDBLCLK : WasHit := '
L-ButtonDBLClick';
WM_LBUTTONDOWN : WasHit := '
L-ButtonDown';
WM_LBUTTONUP : WasHit := '
L-ButtonUp';
WM_MBUTTONDBLCLK : WasHit := '
M-ButtonDBLClick';
WM_MBUTTONDOWN : WasHit := '
M ButtonDown';
WM_MBUTTONUP : WasHit := '
M-ButtonUp';
WM_RBUTTONDBLCLK : WasHit := '
R-ButtonDBLClick';
WM_RBUTTONDOWN : WasHit := '
R-ButtonDown';
WM_RBUTTONUP : WasHit := '
R-ButtonUp';
WM_XBUTTONDBLCLK : WasHit := '
X-ButtonDBLClick';
WM_XBUTTONDOWN : WasHit := '
X-ButtonDown';
WM_XBUTTONUP : WasHit := '
X-ButtonUp';
WM_MOUSEHOVER : WasHit := '
MouseHover';
WM_MOUSELEAVE : WasHit := '
MouseLeave';
WM_MOUSEMOVE : WasHit := '
MouseMove';
WM_MOUSEWHEEL : WasHit := '
MouseWheel';
WM_MOUSEACTIVATE : WasHit := '
MouseActivate';
WM_NCLBUTTONDOWN : WasHit := '
NCL-L-ButtonDown';
else
WasHit := IntToStr(wparam);
end;
XKord := PMSDLLHookInfo(lParam).POINT.X;
YKord := PMSDLLHookInfo(lParam).POINT.Y;
mVKCode := PMSDLLHookInfo(lParam).wHitTestCode;
case mVKCode
of
HTBORDER : WoHit := '
Border';
HTBOTTOM : WoHit := '
Bottom';
HTBOTTOMLEFT : WoHit := '
BottomLeft';
HTBOTTOMRIGHT : WoHit := '
BottomRight';
HTCAPTION : WoHit := '
Caption';
HTCLIENT : WoHit := '
Client';
HTCLOSE : WoHit := '
Close';
HTERROR : WoHit := '
Error';
HTHELP : WoHit := '
Help';
HTHSCROLL : WoHit := '
Scroll';
HTLEFT : WoHit := '
Left';
HTMENU : WoHit := '
Menu';
HTREDUCE : WoHit := '
Reduce';
HTNOWHERE : WoHit := '
Nowhere';
HTRIGHT : WoHit := '
Right';
HTSIZE : WoHit := '
Size';
HTSYSMENU : WoHit := '
SysMenu';
HTTOP : WoHit := '
Top';
HTTOPLEFT : WoHit := '
TopLeft';
HTTOPRIGHT : WoHit := '
TopRight';
HTTRANSPARENT : WoHit := '
Transparent';
HTVSCROLL : WoHit := '
V-Scroll';
HTZOOM : WoHit := '
Zoom';
else
WoHit := IntToStr(mVKCode);
end;