TForm1 = class(TForm)<br> Panel1: TPanel;<br> procedure Panel1MouseDown(Sender: TObject; Button: TMouseButton;<br> Shift: TShiftState; X, Y: Integer);<br> procedure Panel1MouseMove(Sender: TObject; Shift: TShiftState; X,<br> Y: Integer);<br> procedure Panel1MouseUp(Sender: TObject; Button: TMouseButton;<br> Shift: TShiftState; X, Y: Integer);<br> private<br> IsCapture : Boolean;<br> public<br> { Public declarations }<br> end;<br><br>procedure TForm1.Panel1MouseDown(Sender: TObject; Button: TMouseButton;<br> Shift: TShiftState; X, Y: Integer);<br>begin<br> if SetCapture(Panel1.Handle) <> 0 then<br> begin<br> Screen.Cursor := crHandPoint;<br> IsCapture := True;<br> end;<br>end;<br><br>procedure TForm1.Panel1MouseMove(Sender: TObject; Shift: TShiftState; X,<br> Y: Integer);<br>var<br> hWindow : HWND;<br> p : TPoint;<br>begin<br> if IsCapture then<br> begin<br> GetCursorPos(p);<br> hWindow := WindowFromPoint(p);<br> Caption := IntToStr(hWindow);<br> end;<br>end;<br><br>procedure TForm1.Panel1MouseUp(Sender: TObject; Button: TMouseButton;<br> Shift: TShiftState; X, Y: Integer);<br>begin<br> Screen.Cursor := crDefault;<br> ReleaseCapture;<br> IsCapture := False;<br>end;