国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 學院 > 開發(fā)設計 > 正文

獲取當前鼠標位置的類名和句柄

2019-11-17 05:11:59
字體:
供稿:網(wǎng)友
  這有點像金山詞霸的屏幕取詞。要獲取當前鼠標位置的類名和句柄,只須通過 WindowFromPoint和GetClassName 這兩個Win32函數(shù)就可以完成任務,不過,假如要獲取當前鼠標位置的字符,可能要復雜得多。
下面是很簡單的范例,大家應該都可以輕易弄清楚的。 type
TForm1 = class(TForm)
NameLB: TLabel;
ClassLB: TLabel;
Timer1: TTimer;
PRocedure Timer1Timer(Sender: TObject);
procedure FormCreate(Sender: TObject);
private
procedure GetMousePosHwndAndClassName(Sender : TPoint);
public

end;

var
Form1: TForm1;

implementation

{$R *.DFM}

procedure TForm1.Timer1Timer(Sender: TObject);
var
rPos: TPoint;
begin
if boolean(GetCursorPos(rPos)) then
GetMousePosHwndAndClassName(rPos);
end;

procedure TForm1.GetMousePosHwndAndClassName(Sender: TPoint);
var
hWnd: THandle;
aName: array [0..255] of char;
begin
hWnd := WindowFromPoint(Sender);
NameLB.Caption := ’Handle : ’ + IntToStr(hWnd);

if boolean(GetClassName(hWnd, aName, 256)) then
ClassLB.Caption := ’ClassName : ’ + string(aName)
else ClassLB.Caption := ’ClassName : not found’;
end;

procedure TForm1.FormCreate(Sender: TObject);
begin
Form1.FormStyle := fsStayOnTop;
Timer1.Interval := 50;
end;

發(fā)表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發(fā)表
主站蜘蛛池模板: 徐汇区| 开封县| 德格县| 南丹县| 多伦县| 罗定市| 花莲市| 中阳县| 宜阳县| 德阳市| 万宁市| 姚安县| 盐边县| 张家川| 木兰县| 营口市| 洪江市| 巴林右旗| 河津市| 噶尔县| 扎兰屯市| 兰考县| 都昌县| 黄陵县| 淄博市| 满洲里市| 蓬溪县| 邹平县| 灌阳县| 勃利县| 东安县| 卓尼县| 礼泉县| 贵溪市| 共和县| 濮阳市| 从江县| 黄陵县| 承德市| 绥宁县| 锡林郭勒盟|