📄 hotkeyunit.~pas
字号:
unit HotKeyUnit;
interface
uses
Windows,Classes,SysUtils;
type
THotKeyThread = class(TThread)
private
{ Private declarations }
protected
procedure Execute; override;
end;
implementation
uses MainForm,Call;
{ Important: Methods and properties of objects in visual components can only be
used in a method called using Synchronize, for example,
Synchronize(UpdateCaption);
and UpdateCaption could look like,
procedure THotKeyThread.UpdateCaption;
begin
Form1.Caption := 'Updated in a thread';
end; }
{ THotKeyThread }
procedure UseHotKey(KeyPos:Integer);
begin
Call.KuaiJieJian(KeyPos-1);
end;
procedure HotKeyProc;
const
{$j+}Key1Time:Integer=0{$j-};
{$j+}Key2Time:Integer=0{$j-};
{$j+}Key3Time:Integer=0{$j-};
{$j+}Key4Time:Integer=0{$j-};
{$j+}Key5Time:Integer=0{$j-};
{$j+}Key6Time:Integer=0{$j-};
var
KillGuaiID:Integer;
begin
Sleep(200);
if hProcess=0 then
exit;
if not MainForm.Form1.CheckBox31.Checked then
exit;
if not MainForm.Form1.Timer2.Enabled then
exit;
if GuaiIsDead then
begin
if Form1.CheckBox32.Checked then //捡物
begin
GetGuaiWuInfo('箱子','未用');
end;
if NoZhanDouBaoHu then
exit;
if Form1.CheckBox35.Checked then
begin
if DingDianProc then
begin
exit;
end;
end;
GetGuaiWuInfo('选怪','未用');
end;
UseJiNeng;
if MainForm.Form1.CheckBox5.Checked then
begin
if Key1Time=0 then
Key1Time:=GetTickCount;
if SleepFun(strtoint(Trim(MainForm.Form1.LabeledEdit13.text)),Key1Time) then
begin
UseHotKey(1);
Key1Time:=0;
end;
Sleep(100);
end;
if MainForm.Form1.CheckBox6.Checked then
begin
if Key2Time=0 then
Key2Time:=GetTickCount;
if SleepFun(strtoint(Trim(MainForm.Form1.LabeledEdit14.text)),Key2Time) then
begin
UseHotKey(2);
Key2Time:=0;
end;
Sleep(100);
end;
if MainForm.Form1.CheckBox7.Checked then
begin
if Key3Time=0 then
Key3Time:=GetTickCount;
if SleepFun(strtoint(Trim(MainForm.Form1.LabeledEdit15.text)),Key3Time) then
begin
UseHotKey(3);
Key3Time:=0;
end;
Sleep(100);
end;
if MainForm.Form1.CheckBox8.Checked then
begin
if Key4Time=0 then
Key4Time:=GetTickCount;
if SleepFun(strtoint(Trim(MainForm.Form1.LabeledEdit16.text)),Key4Time) then
begin
UseHotKey(4);
Key4Time:=0;
end;
Sleep(100);
end;
end;
procedure THotKeyThread.Execute;
begin
while(not Terminated) do
begin
Sleep(100);
HotKeyProc;
end;
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -