七
某人,手工刷分,很辛苦。
做个程序模拟下,方便些。
必要条件:大厅双开,上网找找有。要么用沙盘运行吧,没测试,应该可以。
刷分流程:垃圾号一个,中分号一个(50-60分),高分号一个,为的就是给这个号刷分。
让垃圾号输分给中分号,中分号输给高分号,注意,不能让中分号的分值始终在50-60分之间,这样,他既可以在低分号上桌,也可以在高分号立脚。分就源源不断从垃圾号经跳板中分号输送到高分号。
本刷分器是个模拟程序,即模拟下棋。
框中是坐标数据。我的屏幕是1440X900。自己可以录制。
使用方法,开四个军棋窗口。高分一个,中分(跳板号)两个,低分号一个。
高分<-中分;中分<-低分
高分按F1定位窗口,中分失分按F2定位窗口,中分得分按F3定位,低分按F4定位。这一步必须要做。
好了按F6开始吧,中间可以按F9停止。F7,F8 用于录制坐标。
源代码全部奉上,如下,have fun
unit main;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, ComCtrls, HotKeyManager, StdCtrls;type
TForm1 = class(TForm)
hkMgr: THotKeyManager;
mmo1: TMemo;
procedure hkMgrHotKeyPressed(HotKey: Cardinal; Index: Word);
procedure FormCreate(Sender: TObject);
private
w1, w2, w3, w4: HWND;
running:integer;
procedure locWind(hk: Cardinal);
procedure startIt;
public
{ Public declarations }
end;var
Form1 : TForm1;
acmd : string;
implementationuses
RegExpr;{$R *.dfm}
procedure TForm1.hkMgrHotKeyPressed(HotKey: Cardinal; Index: Word);
var
p : TPoint;
r : TRect;
theH : HWND;
begin
case HotKey of
112, 113, 114, 115: locWind(HotKey);
117: startIt;
118:
begin
GetCursorPos(p);
theH := WindowFromPoint(p);
if theH = w1 then
acmd := ‘1′
else
if theH = w2 then
acmd := ‘2′
else
if theH = w3 then
acmd := ‘3′
else
acmd := ‘4′;
GetWindowRect(theH, r);
acmd := acmd + ‘-’ + Format(‘%d-%d’, [p.X - r.Left, p.Y - r.Top]);
end;
119:
begin
GetCursorPos(p);
theH := WindowFromPoint(p);
GetWindowRect(theH, r);
acmd := acmd + ‘-’ + Format(‘%d-%d’, [p.X - r.Left, p.Y - r.Top]);
mmo1.Lines.Add(acmd);
acmd := ”;
end;
120: running := 1;
else
end;
end;function ForceForegroundWindow(hwnd: THandle): Boolean;
const
SPI_GETFOREGROUNDLOCKTIMEOUT = $2000;
SPI_SETFOREGROUNDLOCKTIMEOUT = $2001;
var
ForegroundThreadID: DWORD;
ThisThreadID : DWORD;
timeout : DWORD;
begin
if IsIconic(hwnd) then ShowWindow(hwnd, SW_RESTORE);
if GetForegroundWindow = hwnd then
Result := True
else
begin
// Windows 98/2000 doesn’t want to foreground a window when some other
// window has keyboard dyydyysoft focus
if ((Win32Platform = VER_PLATFORM_WIN32_NT) and (Win32MajorVersion > 4)) or
((Win32Platform = VER_PLATFORM_WIN32_WINDOWS) and
((Win32MajorVersion > 4) or ((Win32MajorVersion = 4) and
(Win32MinorVersion > 0)))) then
begin
Result := False;
ForegroundThreadID := GetWindowThreadProcessID(GetForegroundWindow, nil);
ThisThreadID := GetWindowThreadProcessID(hwnd, nil);
if AttachThreadInput(ThisThreadID, ForegroundThreadID, True) then
begin
BringWindowToTop(hwnd); // IE 5.5 related hack
SetForegroundWindow(hwnd);
AttachThreadInput(ThisThreadID, ForegroundThreadID, False);
Result := (GetForegroundWindow = hwnd);
end;
if not Result then
begin
// Code by Daniel P. Stasinski
SystemParametersInfo(SPI_GETFOREGROUNDLOCKTIMEOUT, 0, @timeout, 0);
SystemParametersInfo(SPI_SETFOREGROUNDLOCKTIMEOUT, 0, TObject(0), SPIF_SENDCHANGE);
BringWindowToTop(hwnd); // IE 5.5 related hack
SetForegroundWindow(hwnd);
SystemParametersInfo(SPI_SETFOREGROUNDLOCKTIMEOUT, 0, TObject(timeout), SPIF_SENDCHANGE);
end;
ShowWindow(hwnd, SW_SHOWNORMAL);
end
else
begin
BringWindowToTop(hwnd); // IE 5.5 related hack
SetForegroundWindow(hwnd);
ShowWindow(hwnd, SW_SHOWNORMAL);
end;
Result := (GetForegroundWindow = hwnd);
end;
end;procedure TForm1.startIt;
var
i : Integer;
th : HWND;
r : TRect;
begin
running := 0;
while running = 0 do
begin
Sleep(1000);
for i := 0 to mmo1.lines.count – 1 do
begin
Application.ProcessMessages ;
if running = 1 then Break;
with TRegExpr.Create do
try
Expression := ‘([1-4])\-(\d*)\-(\d*)-(\d*)-(\d*)’;
if Exec(mmo1.Lines[i]) then
begin
case StrToIntdef(match[1], 0) of
1: th := w1;
2: th := w2;
3: th := w3;
4: th := w4;
else
Continue;
end;
Sleep(600);
if th <> 0 then ForceForegroundWindow(th);
GetWindowRect(th, r);
SetCursorPos(r.Left + StrToInt(Match[2]), r.Top + StrToInt(Match[3]));
mouse_event(MOUSEEVENTF_LEFTDOWN, 0, 0, 0, 0);
Sleep(10);
mouse_event(MOUSEEVENTF_LEFTUP, 0, 0, 0, 0);
Sleep(10);
mouse_event(MOUSEEVENTF_LEFTDOWN, 0, 0, 0, 0);
Sleep(10);
mouse_event(MOUSEEVENTF_LEFTUP, 0, 0, 0, 0);
Sleep(600);
SetCursorPos(r.Left + StrToInt(Match[4]), r.Top + StrToInt(Match[5]));
mouse_event(MOUSEEVENTF_LEFTDOWN, 0, 0, 0, 0);
Sleep(10);
mouse_event(MOUSEEVENTF_LEFTUP, 0, 0, 0, 0);
Sleep(10);
mouse_event(MOUSEEVENTF_LEFTDOWN, 0, 0, 0, 0);
Sleep(10);
mouse_event(MOUSEEVENTF_LEFTUP, 0, 0, 0, 0);
end;
finally
Free;
end;
end;
Application.ProcessMessages;
end;
end;procedure TForm1.FormCreate(Sender: TObject);
begin
hkMgr.AddHotKey(112);
hkMgr.AddHotKey(113);
hkMgr.AddHotKey(114);
hkMgr.AddHotKey(115);
hkMgr.AddHotKey(117);
hkMgr.AddHotKey(118);
hkMgr.AddHotKey(119);
hkMgr.AddHotKey(120);
end;procedure TForm1.locWind(hk: Cardinal);
var
p : TPoint;
r : TRect;
var
Buf : array[0..255] of Char;
tH : HWND;
FLASHWINFO : TFLASHWINFO;
i : integer;
begin
GetCursorPos(p);
th := WindowFromPoint(p);
FillChar(Buf, 256, #0);
// tH := GetTopWindow(GetDesktopWindow);
// th:=GetParent(th);
SendMessage(tH, WM_GETTEXT, 256, Integer(@Buf)); // 得到标题
//if IsWindowUnicode(th) then StrCopy(@Buf, PAnsiChar(@Buf));
//for i := 0 to 10 do FlashWindow(th, True);welcome2abingle.com
if Pos(‘四国军棋’, StrPas(@Buf)) > 0 then
begin
FLASHWINFO.cbSize := sizeof(FLASHWINFO);
FLASHWINFO.hwnd := th;
FLASHWINFO.dwFlags := FLASHW_ALL or FLASHW_STOP; //同时闪烁标题栏和托盆窗口
FLASHWINFO.uCount := 5;
FLASHWINFO.dwTimeout := 10; //闪烁时间间隔为10毫秒
FlashWindowEx(FLASHWINFO); //开始闪烁,将填充的FLASHWINFO结构作为参数
GetWindowRect(tH, r);for i := 0 to 4 do //抖动窗口
begin
MoveWindow(th, r.Left + 2, r.Top, r.Right – r.Left, r.Bottom – r.Top, True);
MoveWindow(th, r.Left + 2, r.Top + 2, r.Right – r.Left, r.Bottom – r.Top, True);
MoveWindow(th, r.Left – 2, r.Top + 2, r.Right – r.Left, r.Bottom – r.Top, True);
MoveWindow(th, r.Left – 2, r.Top – 2, r.Right – r.Left, r.Bottom – r.Top, True);
end;case hk of
112:
begin
w1 := tH;
Buf := ‘高分得分四国军棋’;
SendMessage(th, WM_SETTEXT, 0, Integer(@Buf));
end;
113:
begin
w2 := tH;
Buf := ‘中分失分四国军棋’;
SendMessage(th, WM_SETTEXT, 0, Integer(@Buf));
end;
114:
begin
w3 := tH;
Buf := ‘中分得分四国军棋’;
SendMessage(th, WM_SETTEXT, 0, Integer(@Buf));
end;
115:
begin
w4 := tH;
Buf := ‘垃圾号四国军棋’;
SendMessage(th, WM_SETTEXT, 0, Integer(@Buf));
end;
end;end;
end;end.