//窗口过程钩子回调函数
function HookProc(icode:Integer;wparam:WPARAM;lparam:LPARAM):LRESULT;stdcall;
var
P:TCWPStruct;
begin
Result := 0 ;
if icode <0 then
Result := CallNextHookEx(WinProcHook,icode,wparam,lparam)
else
begin
p:= PCWPStruct(lparam)^;
if P.message = WM_NCPaint then
begin
{你要做的处理}
Result:= 1;
end;
end;
end;
procedure InstallHook;
begin
WinProcHook:= SetWindowsHookEx(WH_CALLWNDPROC,@HookProc,Hinstance,dwThreadID);
end;
procedure UnInstallHook;
begin
UnHookWindowsHookEx(WinProcHook)
end;