关于捕获 鼠标 在程序窗口以外地方 移动 的消息
解决方案 »
- 打开百度首页后,自动输入关键词,如“热卖商品”,并搜索,如何实现?
- VclSkin 2.45 怎么在Delphi2007中安装?
- 半年多沒有安裝D6了竟然不知道Delphi 6.0 的sn了
- 在FormCreate中规定的初始化动作为什么没有执行?在线等候。谢谢!
- pdg格式的文件怎么打开?
- 关于表的字段的修改问题?
- 谁知道如何写代理软件?
- Access并发问题
- 又是一个Base64问题~~~
- 一个我认为非常棒的报表控件,商务软件开发首选--以下是她的介绍:
- 在isapi中,如何可分解读取图像和文字混合上传的request.content值??
- 关于PACKAGE和DLL,在撰写大型数据库程序时应该选择那一种,我需要源代码
unit Unit1; interface uses Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls; type
TForm1 = class(TForm)
Button1: TButton;
Edit1: TEdit;
procedure Button1Click(Sender: TObject);
procedure FormMouseDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
private
{ Private declarations }
public
{ Public declarations }
end; var Form1: TForm1; implementation {$R *.DFM}
procedure TForm1.Button1Click(Sender: TObject);
begin
setcapture(handle); // 设置捕获鼠标输入
end; procedure TForm1.FormMouseDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
var point : TPoint;
hwnd : THandle;
begin
point.x := x;
point.y := y;
point := ClientToScreen(point); // 客户区坐标转换到屏幕坐标
hwnd := WindowFromPoint(point); // 取鼠标点击的窗体句柄
ReleaseCapture; // 终止捕获鼠标输入
if hwnd=handle then edit1.text := '没有点击其他窗体!'
else
edit1.Text := inttostr(hwnd); // 将捕捉到的窗体句柄显示在edit1中
end; end.