当鼠标进入窗体时,有什么消息啊,
类似于QQ当鼠标进入时,窗体弹出,离开时,窗体缩回,有没有这两个消息,能写出来?

解决方案 »

  1.   

    个人认为这个东西应该是桌面这个窗口的消息其实直接用GetCursorPos来判断鼠标当前位置,如果在某个区域内就让窗口出来,否则缩回!
      

  2.   

    MouseMove事件中通过获得鼠标坐标看是否在某一区域内,在则显示窗体,不在了则隐藏
      

  3.   

    怎么,用Timer不好吗,本来Timer就是提供一种机制,你不用Timer用什么如果全局变量Screen的类有对应的事件我们可以拿来用用,可惜它没有。要不你就自己做个Hook来拦截桌面窗体的消息!!呵呵......
      

  4.   

    To U2M  你说的MouseMove事件是什么对象的????
      

  5.   

    第一用HOOK
    第二用Timer
    第三继承后,重新加入CM_MOUSEENTER, CM_MOUSELEAVE两个事件
      

  6.   

    unit Unit1;interfaceuses
      Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
      Dialogs, StdCtrls;type
      TForm1 = class(TForm)
        Button1: TButton;
        procedure FormCreate(Sender: TObject);
        procedure Button1Click(Sender: TObject);
      private
        { Private declarations }
        procedure CMMouseEnter(var Message: TMessage); message CM_MOUSEENTER;
        procedure CMMouseLeave(var Message: TMessage); message CM_MOUSELEAVE;
      public
        { Public declarations }
      end;var
      Form1: TForm1;implementation{$R *.dfm}procedure TForm1.CMMouseEnter(var Message: TMessage);
    begin
      case Message.Msg of
        CM_MOUSEENTER:begin
                         SetCapture(Handle);
                         if Self.Height < 100 then
                            self.Height := 300;
                         self.Invalidate;
                      end;
        end;end;procedure TForm1.CMMouseLeave(var Message: TMessage);
    begin
      case Message.Msg of
         CM_MOUSELEAVE: begin
                          if self.Height > 100 then
                            self.Height := 50;
                          self.Invalidate;
                          ReleaseCapture;
                        end;     end;
    end;procedure TForm1.FormCreate(Sender: TObject);
    begin
      if (self.Left > 1000) and (self.Top < 50) then
      begin
        self.Height := 10;
        self.Refresh;
        
      end;
    end;procedure TForm1.Button1Click(Sender: TObject);
    begin
      SetSystemPowerState(true,false)
    end;end.大概得做了一下,不是很好
      

  7.   

    堕落天使说得比较全了楼上兄弟的方法很正规,我比较喜欢Timer+Mouse.CursorPos
      

  8.   

    比较同样堕落天使
    我喜欢的方法:
    GetWindowLong();取GWL_WNDPROC
    SetWindowLong();连上自己的PROC函数(此函数中处理你要的消息)
    在自己的PROC函数中不要忘了,把消息再传回第一步取到的原始PROC地址
      

  9.   

    呵呵,用VCL自定义消息的方法俺到是还没有想到过,学习,呵呵!!!!