unit Unit1;interfaceuses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  StdCtrls;
const
  WM_TestMessage = WM_USER + 2000;
type
  TForm1 = class(TForm)
    Button1: TButton;
    Memo1: TMemo;
    procedure FormCreate(Sender: TObject);
    procedure Button1Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;var
  Form1: TForm1;implementation{$R *.DFM}
var
  HookHandle: HHOOK;function TestHookProc(Code: Integer; WParam: Longint;Msg:Longint): Longint;stdcall;
begin
    if (Code = HC_ACTION) then
    if (PMsg(Msg)^.Message = WM_TestMessage) then
    begin
       Application.MessageBox('已经拦截此消息!', '提示', MB_OK + MB_ICONINFORMATION);
    end;
    Result := CallNextHookEx(HookHandle, Code, WParam, Longint(@Msg));
end;procedure TForm1.FormCreate(Sender: TObject);
begin
  HookHandle:=SetWindowsHookEx(WH_GETMESSAGE,@TestHookProc,0,GetCurrentThreadID);
end;procedure TForm1.Button1Click(Sender: TObject);
begin
  PostMessage(self.Handle,WM_TestMessage,0,101);
end;end.使用DELPHI 7 拦截后的对话框提示信息就显示一次, 但是使用DELPHI 2010 他那个提示信息框就显示2次想问问各位高手为什么会这样