我把WM_MOVE和WM_SIZE放在ApplicationEvent控件里,结果什么都没发生。给WM_MOVE设断点,移动程序窗体的时候就没跳进去。WM_SIZE也是,倒是程序创建的时候WM_SIZE有两次操作,这是为什么啊
procedure TMainfrm.ApplicationEventsMessage(var Msg: tagMSG;
  var Handled: Boolean);
begin
  case Msg.message of
    WM_MOVE: Panel8.Invalidate;
    WM_SIZE: Panel8.Invalidate;
  end;
end;

解决方案 »

  1.   

      TForm1 = class(TForm)
      private
        { Private declarations }
        procedure WndProc(var Msg: TMessage); override; 
      public
        { Public declarations }
      end;var
      Form1: TForm1;
      i: integer = 1;
    implementation{$R *.dfm}procedure TForm1.WndProc(var Msg: TMessage);
    begin
      if Msg.Msg = WM_Size then
      begin
        Caption := 'WMSize' + IntToStr(i);
        Inc(i);
      end
      else if Msg.Msg = WM_Move then
      begin
        Caption := 'WMMove' + IntToStr(i);
        Inc(i);
      end;
      inherited;
    end;
      

  2.   

    up
     inherited; 
    这句的作用是什么?
      

  3.   

    继承父类的WndProc 不然其他消息得不到处理
      

  4.   

    恩,跳进去了,用ApplicationEventsMessage怎么就不行了呢,奇怪的