这是我的例子.<br><br>var<br> WHook : HHook;<br> ScrCapInst : TDXCapture;<br><br>{------------------------------------------------------------------------------}<br>function CallWndProcHook(nCode: Integer; wParam: longint; var Msg: TCWPStruct) : longint;<br> stdcall;<br>begin<br> case Msg.message of<br> WM_DISPLAYCHANGE: ScrCapInst.ScreenChang;<br> end;<br> Result := CallNextHookEx(WHook, nCode, wParam, longint(@Msg))<br>end;<br><br>{------------------------------------------------------------------------------}<br>procedure AddHook(SCI: TDXCapture);<br>begin<br> if ScrCapInst = nil then<br> ScrCapInst := SCI;<br> WHook := SetWindowsHookEx(WH_CALLWNDPROC, @CallWndProcHook, 0, GetCurrentThreadId)<br>end;<br><br>{------------------------------------------------------------------------------}<br>procedure RemoveHook;<br>begin<br> UnHookWindowsHookEx(WHook);<br> ScrCapInst := nil<br>end;<br>