如题

解决方案 »

  1.   

    用TApplicationEvents控件。
    例如:
    procedure TForm1.ApplicationEvents1Message(var Msg: tagMSG;
      var Handled: Boolean);
    begin
      if Msg.Handle = Button1.Handle then
      begin
        。。
        Handled := TRUE;
      end;
    end;
    Msg结构:
    TMsg = packed record
        hwnd: HWND;
        message: UINT;
        wParam: WPARAM;
        lParam: LPARAM;
        time: DWORD;
        pt: TPoint;  end;
      

  2.   

    //关于消息祥解.
    http://expert.csdn.net/Expert/topic/2278/2278663.xml?temp=.2748834
      

  3.   

    覆盖wndproc方法应该也可以吧,可是怎么没有效果呢
      

  4.   

    要是只是拦截特定的 消息的话
    procedure yourmessageHandle (var msg:TMsg);message yourMessage;
    begin
      if msg.message=yourmessage then
        abort
      else
        inherited;
    end;
      

  5.   

    哎,我想拦截的是realAudio控件的右键单击消息,不让他弹出菜单,不知道怎么拦
      

  6.   

    可以这么拦截:
    procedure TForm1.ApplicationEvents1Message(var Msg: tagMSG;
      var Handled: Boolean);
    begin
      if Msg.message = WM_RBUTTONDOWN then
      if PtInRect( Rect(realAudio.Left + Left,
                        realAudio.Top + Top,
                        realAudio.Width + realAudio.Left + Left,
                        realAudio.Height + realAudio.Top + Top),
                   Point(Mouse.CursorPos.X,Mouse.CursorPos.Y ) ) then
      begin    
        Handled := TRUE;
      end;
    end;