一応コードです.
var
Hook: HHOOK;
function GetMsgProc(code:integer;wparam:WPARAM;lparam:LPARAM):LRESULT;stdcall;
var
Msg: PMsg;
begin
if (code < 0) then begin
result := CallNextHookEx(Hook,code,wparam,lparam);
exit;
end;
if (code = HC_ACTION) then begin
Msg := PMsg(lparam);
case Msg^.message of
WM_MOUSEMOVE:begin
if wparam = PM_REMOVE then
//処理
end;
end;
end;
result := CallNextHookEx(Hook,code,wparam,lparam);
end;
procedure TForm1.FormShow(Sender: TObject);
begin
Hook := SetWindowsHookEx(WH_GETMESSAGE,GetMsgProc,0,GetCurrentThreadID);
end;
procedure TForm1.FormDestroy(Sender: TObject);
begin
UnHookWindowsHookEx(Hook);
end;
|