📄 unit1.pas
字号:
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
StdCtrls, Spin, Buttons, Menus, ExtCtrls,shellapi, XPMenu;
const
seaMsg=WM_USER+100;
type
TForm1 = class(TForm)
GroupBox1: TGroupBox;
GroupBox2: TGroupBox;
BitBtn1: TBitBtn;
Label1: TLabel;
SpinEdit1: TSpinEdit;
Label2: TLabel;
SpinEdit2: TSpinEdit;
GroupBox3: TGroupBox;
GroupBox4: TGroupBox;
Label3: TLabel;
SpinEdit3: TSpinEdit;
Label4: TLabel;
Button1: TButton;
Button2: TButton;
Timer1: TTimer;
Timer2: TTimer;
PopupMenu1: TPopupMenu;
N1: TMenuItem;
N2: TMenuItem;
N3: TMenuItem;
N4: TMenuItem;
N5: TMenuItem;
RadioButton1: TRadioButton;
RadioButton2: TRadioButton;
SpinEdit16: TSpinEdit;
Label18: TLabel;
Label19: TLabel;
SpinEdit17: TSpinEdit;
Panel1: TEdit;
GroupBox5: TGroupBox;
Label5: TLabel;
SpinEdit4: TSpinEdit;
Label7: TLabel;
SpinEdit6: TSpinEdit;
Label6: TLabel;
SpinEdit5: TSpinEdit;
Label8: TLabel;
SpinEdit7: TSpinEdit;
SpinEdit11: TSpinEdit;
SpinEdit15: TSpinEdit;
Label17: TLabel;
Label13: TLabel;
Label12: TLabel;
Label16: TLabel;
SpinEdit10: TSpinEdit;
SpinEdit14: TSpinEdit;
Label11: TLabel;
SpinEdit9: TSpinEdit;
Label15: TLabel;
SpinEdit13: TSpinEdit;
Label10: TLabel;
SpinEdit8: TSpinEdit;
Label14: TLabel;
SpinEdit12: TSpinEdit;
XPMenu1: TXPMenu;
procedure Button2Click(Sender: TObject);
procedure BitBtn1Click(Sender: TObject);
procedure FormCreate(Sender: TObject);
procedure FormClose(Sender: TObject; var Action: TCloseAction);
procedure Timer1Timer(Sender: TObject);
procedure N5Click(Sender: TObject);
procedure N1Click(Sender: TObject);
procedure Button1Click(Sender: TObject);
procedure Timer2Timer(Sender: TObject);
procedure N2Click(Sender: TObject);
procedure N3Click(Sender: TObject);
private
{ Private declarations }
procedure myIconPro(var SeaMsg:TMessage);Message seaMsg;
public
{ Public declarations }
end;
var
Form1: TForm1;
time_count:Integer;
seaIcon:NotifyIconData;
xo,yo:integer;
implementation
{$R *.DFM}
procedure TForm1.Button2Click(Sender: TObject);
begin
Hide;
end;
procedure TForm1.BitBtn1Click(Sender: TObject);
begin
if Bitbtn1.Caption='测试' then
begin
Timer1.Enabled:=True;
Bitbtn1.Caption:='停止';
end
else
if Bitbtn1.Caption='停止' then
begin
Timer1.Enabled:=False;
Bitbtn1.Caption:='测试';
end;
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
Timer1.Interval:=1000;
Timer2.Interval:=1000;
Timer1.Enabled:=False;
Timer2.Enabled:=False;
seaIcon.cbSize:=sizeof(NotifyIconData);
seaIcon.Wnd:=handle;
seaIcon.uID:=0;
seaIcon.uFlags:=NIF_MESSAGE or NIF_ICON or NIF_TIP;
seaIcon.uCallbackMessage:=SeaMsg;
seaIcon.hIcon:=Application.Icon.Handle;
seaIcon.szTip:='CashFiest Tools';
shell_NotifyIcon(NIM_ADD,@seaIcon);
end;
procedure TForm1.FormClose(Sender: TObject; var Action: TCloseAction);
begin
Action:=caNone;
Form1.Hide;
end;
procedure TForm1.Timer1Timer(Sender: TObject);
var
P:TPoint;
SCanvas:TCanvas;
begin
GetCursorPos(p);
SCanvas:=TCanvas.Create;
try
SCanvas.Handle:=GetDC(0);
Panel1.Color:=SCanvas.Pixels[p.x,p.y];
//GroupBox3.Caption:='当前颜色的十进制值为:'+inttostr(Integer(Panel1.Color));
Panel1.Font.Color:=$02FFFFFF-Panel1.Color;
Panel1.Text:=inttostr(Integer(Panel1.Color));
SpinEdit1.Value:=p.x ;
SpinEdit2.Value:=p.y;
except
Scanvas.Free;
end;
end;
procedure TForm1.N5Click(Sender: TObject);
begin
Timer1.Enabled:=False;
Timer2.Enabled:=False;
shell_NotifyIcon(NIM_DELETE,@seaIcon);
Close;
Application.Terminate;
end;
procedure TForm1.myIconPro(var SeaMsg: TMessage);
var
p_temp:TPoint;
begin
inherited;
if SeaMsg.LParam=WM_RBUTTONDOWN then
begin
GetCursorPos(p_temp);
Popupmenu1.Popup(p_temp.x,p_temp.y);
end;
end;
procedure TForm1.N1Click(Sender: TObject);
begin
Form1.Show;
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
Timer1.Enabled:=False;
Timer2.Interval:=1000;
Timer2.Enabled:=True;
Form1.Hide;
end;
procedure TForm1.Timer2Timer(Sender: TObject);
var
p_p:TPoint;
p_Canvas:TCanvas;
p_cx,p_sx,p_sy:integer;
begin
time_count:=time_count+1;
getCursorPos(p_p);
p_Canvas:=TCanvas.Create;
try
p_Canvas.Handle:=GetDC(0);
xo:=p_p.x;
yo:=p_p.y;
if time_count=Spinedit3.Value then
begin
seaIcon.hIcon:=Form1.Icon.Handle;
seaIcon.szTip:='鼠标控制中....';
shell_NotifyIcon(NIM_MODIFY,@seaIcon);
for p_cx:=0 to screen.Width do
if (integer(p_Canvas.Pixels[p_cx,spinedit4.Value])=spinEdit6.Value) and (integer(p_Canvas.Pixels[p_cx,spinedit5.Value])=spinEdit7.Value) then
begin
if radiobutton1.Checked=True then
begin
for p_sy:=(spinedit4.Value-spinedit17.Value) to (spinedit4.Value+spinedit17.Value) do
for p_sx:=(p_cx-spinedit16.Value) to (p_cx+spinedit16.Value) do
begin
setCursorPos(p_sx,p_sy);
end;
setCursorPos(p_cx,spinedit4.value);
mouse_event(MOUSEEVENTF_LEFTDOWN,0,0,0,0);
mouse_event(MOUSEEVENTF_LEFTUP,2,2,0,0);
mouse_event(MOUSEEVENTF_LEFTDOWN,1,1,0,0);
mouse_event(MOUSEEVENTF_LEFTUP,2,2,0,0);
break;
end
else
if radiobutton2.Checked=True then
begin
for p_sy:=(spinedit5.Value-spinedit17.Value) to (spinedit5.Value+spinedit17.Value) do
for p_sx:=(p_cx-spinedit16.Value) to (p_cx+spinedit16.Value) do
begin
setCursorPos(p_sx,p_sy);
end;
setCursorPos(p_cx,spinedit5.Value);
mouse_event(MOUSEEVENTF_LEFTDOWN,2,2,0,0);
mouse_event(MOUSEEVENTF_LEFTUP,0,0,0,0);
mouse_event(MOUSEEVENTF_LEFTDOWN,1,1,0,0);
mouse_event(MOUSEEVENTF_LEFTUP,2,2,0,0);
break;
end;
end
else
if (integer(p_Canvas.Pixels[p_cx,spinedit8.Value])=spinEdit9.Value) and (integer(p_Canvas.Pixels[p_cx,spinedit10.Value])=spinEdit11.Value) then
begin
if radiobutton1.Checked=True then
begin
for p_sy:=(spinedit8.Value-spinedit17.Value) to (spinedit8.Value+spinedit17.Value) do
for p_sx:=(p_cx-spinedit16.Value) to (p_cx+spinedit16.Value) do
begin
setCursorPos(p_sx,p_sy);
end;
setCursorPos(p_cx,spinedit8.Value);
mouse_event(MOUSEEVENTF_LEFTDOWN,0,0,0,0);
mouse_event(MOUSEEVENTF_LEFTUP,2,2,0,0);
mouse_event(MOUSEEVENTF_LEFTDOWN,1,1,0,0);
mouse_event(MOUSEEVENTF_LEFTUP,2,2,0,0);
break;
end
else
if radiobutton2.Checked=True then
begin
for p_sy:=(spinedit10.Value-spinedit17.Value) to (spinedit10.Value+spinedit17.Value) do
for p_sx:=(p_cx-spinedit16.Value) to (p_cx+spinedit16.Value) do
begin
setCursorPos(p_sx,p_sy);
end;
setCursorPos(p_cx,spinedit10.Value);
mouse_event(MOUSEEVENTF_LEFTDOWN,2,2,0,0);
mouse_event(MOUSEEVENTF_LEFTUP,0,0,0,0);
mouse_event(MOUSEEVENTF_LEFTDOWN,1,1,0,0);
mouse_event(MOUSEEVENTF_LEFTUP,2,2,0,0);
break;
end;
end
else
if (integer(p_Canvas.Pixels[p_cx,spinedit12.Value])=spinEdit13.Value) and (integer(p_Canvas.Pixels[p_cx,spinedit14.Value])=spinEdit15.Value) then
begin
if radiobutton1.Checked=True then
begin
for p_sy:=(spinedit12.Value-spinedit17.Value) to (spinedit12.Value+spinedit17.Value) do
for p_sx:=(p_cx-spinedit16.Value) to (p_cx+spinedit16.Value) do
begin
setCursorPos(p_sx,p_sy);
end;
setCursorPos(p_cx,spinedit12.Value);
mouse_event(MOUSEEVENTF_LEFTDOWN,0,0,0,0);
mouse_event(MOUSEEVENTF_LEFTUP,2,2,0,0);
mouse_event(MOUSEEVENTF_LEFTDOWN,1,1,0,0);
mouse_event(MOUSEEVENTF_LEFTUP,2,2,0,0);
break;
end
else
if radiobutton2.Checked=True then
begin
for p_sy:=(spinedit14.Value-spinedit17.Value) to (spinedit14.Value+spinedit17.Value) do
for p_sx:=(p_cx-spinedit16.Value) to (p_cx+spinedit16.Value) do
begin
setCursorPos(p_sx,p_sy);
end;
setCursorPos(p_cx,spinedit14.Value);
mouse_event(MOUSEEVENTF_LEFTDOWN,2,2,0,0);
mouse_event(MOUSEEVENTF_LEFTUP,0,0,0,0);
mouse_event(MOUSEEVENTF_LEFTDOWN,1,1,0,0);
mouse_event(MOUSEEVENTF_LEFTUP,2,2,0,0);
break;
end;
end;
setCursorPos(xo,yo);
ReleaseDC(0,Canvas.handle);
end
else
if time_count>Spinedit3.value then
begin
seaIcon.hIcon:=Application.Icon.Handle;
seaIcon.szTip:='监控中....';
shell_NotifyIcon(NIM_MODIFY,@seaIcon);
time_count:=0;
end;
except
ReleaseDC(0,Canvas.handle);
Canvas.Free;
end;
end;
procedure TForm1.N2Click(Sender: TObject);
begin
Timer2.Enabled:=False;
end;
procedure TForm1.N3Click(Sender: TObject);
begin
Timer2.Enabled:=True;
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -