高分求救,怎么实现让鼠标移动时,旁边有一个小窗口也跟着移动?是不是要使用HOOK技术?鼠标可以在任何范围中移动。谢谢

解决方案 »

  1.   

    注意不是Hint效果,是一个面积较小的form窗口!
      

  2.   

    建两个form,form1上放个按牛,点完弹出form2,在form2的mousemove事件中移动form1 ,随便写个例子,大概其是这个意思吧。var
      Form1: TForm1;implementationuses Unit2;{$R *.dfm}procedure TForm1.Button1Click(Sender: TObject);
    begin
      Form2 := TForm2.Create(self);
      Form2.ShowModal;
    end;end......................................................var
      Form2: TForm2;implementationuses Unit1;{$R *.dfm}procedure TForm2.FormMouseMove(Sender: TObject; Shift: TShiftState; X,
      Y: Integer);
    begin
      MoveWindow(form1.Handle, X, Y, Form1.Width, Form1.Height, true);
    end;end.
      

  3.   

    to 菜鸟:你的想法是有二个form,但是我现在的要求是:只有一个form窗口,然后鼠标在屏幕上任何区域移动,这个唯一的小窗口要跟着移动!谢谢你啦
      

  4.   

    unit Unit1;interfaceuses
      Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
      Dialogs, ExtCtrls;type
      TForm1 = class(TForm)
        Timer1: TTimer;
        procedure Timer1Timer(Sender: TObject);
      private
        { Private declarations }
      public
        { Public declarations }
      end;var
      Form1: TForm1;implementation{$R *.dfm}
    function mousehookproc(ncode:smallint;wparam,lparam:integer):integer;stdcall;
    beginend;
    procedure TForm1.Timer1Timer(Sender: TObject);
    begin
    left:=mouse.CursorPos.X+2;
    top:=mouse.CursorPos.Y+2;
    end;end.
      

  5.   

    楼上的,请问mousehookproc中应该写些什么啊