das Ganze ist eine Callback-Funktion:
Delphi-Quellcode:
function MouseHookProc(nCode: Integer; wParam: WPARAM; lParam: LPARAM): LRESULT; stdcall;
var
P: PEventMsg;
begin
Result := CallNextHookEx(0, nCode, wParam, lParam);
If nCode = HC_ACTION then
begin
If lParam <> 0 then
begin
P := PEventMsg(lParam);
If P^.Message = WM_KEYDOWN then
begin
Form1.Label1.Caption:=IntToStr((LOWORD(P^.paramL)));
end
end
else
exit;
end;
end;