完美国际私服小工具

EXE: http://files.cnblogs.com/xe2011/spt.rar

pascal DELPHI 2010: http://files.cnblogs.com/xe2011/wmgj2014-4-9-183216.7z

 【2014-1-8】

完美国际私服小工具

[2014-1-2]

 完美国际私服小工具

 完美国际私服小工具

[2014-1-1]

完美国际私服小工具

 

 

  1 unit Unit1;

  2 

  3 interface

  4 uses

  5   Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,

  6   Dialogs, StdCtrls, ExtCtrls, MMSystem, Menus,  ComCtrls;

  7 type

  8   TForm1 = class(TForm)

  9     PageControl1: TPageControl;

 10     TabSheet1: TTabSheet;

 11     TabSheet2: TTabSheet;

 12     TabSheet3: TTabSheet;

 13     ComboBox1: TComboBox;

 14     Button1: TButton;

 15     Button2: TButton;

 16     Edit1: TEdit;

 17     Button3: TButton;

 18     Label1: TLabel;

 19     Button4: TButton;

 20     ComboBox4: TComboBox;

 21     Button5: TButton;

 22     TabSheet4: TTabSheet;

 23     TrayIcon1: TTrayIcon;

 24     PopupMenu1: TPopupMenu;

 25     Update1: TMenuItem;

 26     N1: TMenuItem;

 27     Close1: TMenuItem;

 28     Image1: TImage;

 29     Button6: TButton;

 30     Label5: TLabel;

 31     ComboBox5: TComboBox;

 32     Label6: TLabel;

 33     btnStart: TButton;

 34     btnStop: TButton;

 35     Button7: TButton;

 36     Timer1: TTimer;

 37     Label7: TLabel;

 38     Button9: TButton;

 39     TimerKey1: TTimer;

 40     TimerKey2: TTimer;

 41     TimerKey3: TTimer;

 42     TimerKey4: TTimer;

 43     TimerKey5: TTimer;

 44     chkSelectAll: TCheckBox;

 45     TimerKey6: TTimer;

 46     TimerKey7: TTimer;

 47     TimerKey8: TTimer;

 48     TimerKey9: TTimer;

 49     GroupBox1: TGroupBox;

 50     cbbKey1: TComboBox;

 51     CheckBox1: TCheckBox;

 52     EditKey1: TEdit;

 53     cbbKey2: TComboBox;

 54     CheckBox2: TCheckBox;

 55     EditKey2: TEdit;

 56     cbbKey3: TComboBox;

 57     CheckBox3: TCheckBox;

 58     EditKey3: TEdit;

 59     cbbKey4: TComboBox;

 60     CheckBox4: TCheckBox;

 61     EditKey4: TEdit;

 62     cbbKey5: TComboBox;

 63     CheckBox5: TCheckBox;

 64     EditKey5: TEdit;

 65     cbbKey6: TComboBox;

 66     CheckBox6: TCheckBox;

 67     EditKey6: TEdit;

 68     cbbKey7: TComboBox;

 69     CheckBox7: TCheckBox;

 70     EditKey7: TEdit;

 71     cbbKey8: TComboBox;

 72     CheckBox8: TCheckBox;

 73     EditKey8: TEdit;

 74     cbbKey9: TComboBox;

 75     CheckBox9: TCheckBox;

 76     EditKey9: TEdit;

 77     LabelPosition: TLabel;

 78     Image2: TImage;

 79     Image3: TImage;

 80     TimerValue1: TTimer;

 81     Label2: TLabel;

 82     Label3: TLabel;

 83     procedure Button1Click(Sender: TObject);

 84     procedure Button2Click(Sender: TObject);

 85     procedure FormCreate(Sender: TObject);

 86     procedure Button3Click(Sender: TObject);

 87     procedure FormClose(Sender: TObject; var Action: TCloseAction);

 88     procedure Button4Click(Sender: TObject);

 89     procedure Button5Click(Sender: TObject);

 90     procedure TrayIcon1Click(Sender: TObject);

 91     procedure Close1Click(Sender: TObject);

 92     procedure Update1Click(Sender: TObject);

 93     procedure Button6Click(Sender: TObject);

 94     procedure btnStopClick(Sender: TObject);

 95     procedure btnStartClick(Sender: TObject);

 96     procedure Button7Click(Sender: TObject);

 97     procedure ComboBox5Change(Sender: TObject);

 98     procedure Timer1Timer(Sender: TObject);

 99     procedure Button9Click(Sender: TObject);

100     procedure TimerKey1Timer(Sender: TObject);

101     procedure CheckBox1Click(Sender: TObject);

102     procedure TimerKey2Timer(Sender: TObject);

103     procedure TimerKey3Timer(Sender: TObject);

104     procedure TimerKey4Timer(Sender: TObject);

105     procedure TimerKey5Timer(Sender: TObject);

106     procedure CheckBox2Click(Sender: TObject);

107     procedure CheckBox3Click(Sender: TObject);

108     procedure CheckBox4Click(Sender: TObject);

109     procedure CheckBox5Click(Sender: TObject);

110     procedure chkSelectAllClick(Sender: TObject);

111     procedure FormShow(Sender: TObject);

112     procedure CheckBox6Click(Sender: TObject);

113     procedure CheckBox7Click(Sender: TObject);

114     procedure CheckBox8Click(Sender: TObject);

115     procedure CheckBox9Click(Sender: TObject);

116     procedure TimerKey6Timer(Sender: TObject);

117     procedure TimerKey7Timer(Sender: TObject);

118     procedure TimerKey8Timer(Sender: TObject);

119     procedure TimerKey9Timer(Sender: TObject);

120     procedure PageControl1Change(Sender: TObject);

121     procedure Image1MouseDown(Sender: TObject; Button: TMouseButton;

122       Shift: TShiftState; X, Y: Integer);

123     procedure Image1MouseUp(Sender: TObject; Button: TMouseButton;

124       Shift: TShiftState; X, Y: Integer);

125     procedure TimerValue1Timer(Sender: TObject);

126   private

127     procedure CreateIniFile;

128     procedure ReadConfig;

129     procedure WriteConfig;

130 

131 

132     procedure InstallHotKey;

133     procedure UnInstallHotKey;

134     procedure HotKeyDown(var Msg: TMessage); message WM_HOTKEY;

135     function SendKey(Str: string): Integer;

136 

137 

138     procedure SetIcon1;

139     procedure SetIcon2;

140     procedure SetMyCursor;

141     procedure RestoreCursor;

142     procedure SetLabelTimerProEnable;

143     procedure SetLabelTimerProDisable;

144  

145   public

146     { Public declarations }

147   end;

148 

149 var

150   Form1: TForm1;

151   HotKeyId, HotKeyId1: Integer;

152 implementation

153 {$R SpyRES.RES}

154 

155 uses ShellApi, IniFiles,  FileCtrl;

156 {$R *.dfm}

157 

158 var

159   IniFile: TIniFile;

160   IniAbsFileName // 'ini的绝对路径'

161     : string;

162 

163 //------------------------------------------------------------------------------

164 

165 procedure TForm1.InstallHotKey;

166 begin

167   HotKeyId := GlobalAddAtom('MyHotKey');

168   HotKeyId1 := GlobalAddAtom('MyHotKey1');

169 

170   RegisterHotKey(Handle, HotKeyId, MOD_ALT + MOD_CONTROL, VkKeyScan('x')); { Ctrl+Alt+x }

171   RegisterHotKey(Handle, HotKeyId1, MOD_ALT + MOD_CONTROL, VkKeyScan('c')); { Ctrl+Alt+c }

172 end;

173 

174 procedure TForm1.UnInstallHotKey;

175 begin

176   UnRegisterHotKey(Handle, HotKeyId);

177   UnRegisterHotKey(Handle, HotKeyId1);

178   DeleteAtom(HotKeyId);

179   DeleteAtom(HotKeyId1);

180 end;

181 

182 procedure TForm1.HotKeyDown(var Msg: TMessage);

183 begin

184     //start

185   if (Msg.LparamLo = MOD_ALT + MOD_CONTROL) and (Msg.LParamHi = VkKeyScan('x')) then

186     btnStart.Click;

187 

188    //stop

189   if (Msg.LparamLo = MOD_ALT + MOD_CONTROL) and (Msg.LParamHi = VkKeyScan('c')) then

190     btnStop.Click;

191 end;

192 

193 //------------------------------------------------------------------------------

194 

195 var iniPath: string; //ini路径

196   fName: string; //ini的文件名

197 //WriteString

198 

199 procedure ComboBoxToINI(const AINIFile, ASection: string; ComboBox: TComboBox);

200 var

201   INI: TINIFile;

202   I: Integer;

203 begin

204   INI := TINIFile.Create(AINIFile);

205   try

206     INI.EraseSection(ASection);

207     INI.WriteInteger(ASection, 'Count', ComboBox.Items.Count);

208     for I := 0 to ComboBox.Items.Count - 1 do

209     begin

210       INI.WriteString(ASection, 'Item' + IntToStr(I), ComboBox.Items[I]);

211     end;

212   finally

213     INI.Free;

214   end;

215 end;

216 

217 //ReadString

218 

219 procedure INIToComboBox(const AINIFile, ASection: string; ComboBox: TComboBox);

220 var

221   INI: TINIFile;

222   I, Count: Integer;

223 begin

224   INI := TINIFile.Create(AINIFile);

225   try

226     Count := INI.ReadInteger(ASection, 'Count', 0);

227     for I := 0 to Count - 1 do

228     begin

229       ComboBox.Items.Add(INI.ReadString(ASection, 'Item' + IntToStr(I), '0'));

230     end;

231   finally

232     INI.Free;

233   end;

234 end;

235 

236 

237 procedure TForm1.CreateIniFile;

238 begin

239   IniAbsFileName := Application.ExeName + '.ini';

240   IniFile := TIniFile.Create(IniAbsFileName);

241 end;

242 

243 procedure TForm1.ReadConfig;

244 begin

245 //  ComboBox4.Text := IniFile.ReadString('MainForm', '游戏路径', 'D:\完美世界国际版\element\elementclient.exe');

246   INIToComboBox(IniAbsFileName, '游戏路径', ComboBox4);

247   ComboBox4.ItemIndex := IniFile.ReadInteger('MainForm', '最后选中', 0);

248 

249   cbbKey1.ItemIndex := IniFile.ReadInteger('按键', '按键1', 0); //TAB

250   cbbKey2.ItemIndex := IniFile.ReadInteger('按键', '按键2', 10); //f1

251   cbbKey3.ItemIndex := IniFile.ReadInteger('按键', '按键3', 11); //f2

252   cbbKey4.ItemIndex := IniFile.ReadInteger('按键', '按键4', 12); //f3

253   cbbKey5.ItemIndex := IniFile.ReadInteger('按键', '按键5', 13); //f4

254 

255   cbbKey6.ItemIndex := IniFile.ReadInteger('按键', '按键6', 14); //f5

256   cbbKey7.ItemIndex := IniFile.ReadInteger('按键', '按键7', 15); //f6

257   cbbKey8.ItemIndex := IniFile.ReadInteger('按键', '按键8', 16); //f7

258   cbbKey9.ItemIndex := IniFile.ReadInteger('按键', '按键9', 17); //f8

259 

260   EditKey1.Text := IniFile.ReadString('按键间隔', '间隔1', '1');

261   EditKey2.Text := IniFile.ReadString('按键间隔', '间隔2', '2');

262   EditKey3.Text := IniFile.ReadString('按键间隔', '间隔3', '1');

263   EditKey4.Text := IniFile.ReadString('按键间隔', '间隔4', '5');

264   EditKey5.Text := IniFile.ReadString('按键间隔', '间隔5', '5');

265   EditKey2.Text := IniFile.ReadString('按键间隔', '间隔6', '5');

266   EditKey3.Text := IniFile.ReadString('按键间隔', '间隔7', '5');

267   EditKey4.Text := IniFile.ReadString('按键间隔', '间隔8', '5');

268   EditKey5.Text := IniFile.ReadString('按键间隔', '间隔9', '5');

269 

270 end;

271 

272 procedure TForm1.WriteConfig;

273 begin

274   ComboBoxToINI(IniAbsFileName, '游戏路径', ComboBox4);

275   IniFile.WriteInteger('MainForm', '最后选中', ComboBox4.ItemIndex);

276   IniFile.WriteInteger('按键', '按键1', cbbKey1.ItemIndex);

277   IniFile.WriteInteger('按键', '按键2', cbbKey2.ItemIndex);

278   IniFile.WriteInteger('按键', '按键3', cbbKey3.ItemIndex);

279   IniFile.WriteInteger('按键', '按键4', cbbKey4.ItemIndex);

280   IniFile.WriteInteger('按键', '按键5', cbbKey5.ItemIndex);

281 

282   IniFile.WriteInteger('按键', '按键6', cbbKey6.ItemIndex);

283   IniFile.WriteInteger('按键', '按键7', cbbKey7.ItemIndex);

284   IniFile.WriteInteger('按键', '按键8', cbbKey8.ItemIndex);

285   IniFile.WriteInteger('按键', '按键9', cbbKey9.ItemIndex);

286 

287   IniFile.WriteString('按键间隔', '间隔1', EditKey1.Text);

288   IniFile.WriteString('按键间隔', '间隔2', EditKey2.Text);

289   IniFile.WriteString('按键间隔', '间隔3', EditKey3.Text);

290   IniFile.WriteString('按键间隔', '间隔4', EditKey4.Text);

291   IniFile.WriteString('按键间隔', '间隔5', EditKey5.Text);

292   IniFile.WriteString('按键间隔', '间隔6', EditKey6.Text);

293   IniFile.WriteString('按键间隔', '间隔7', EditKey7.Text);

294   IniFile.WriteString('按键间隔', '间隔8', EditKey8.Text);

295   IniFile.WriteString('按键间隔', '间隔9', EditKey9.Text);

296 

297 end;

298 

299 // 产生随机字符串

300 

301 function GeneralPwd(StrLength: Integer; rType: Integer): string;

302 var

303   i: Integer;

304   str, str1, str2, str3, reslt1: string;

305 begin

306   str1 := '0123456789'; { 字符0~9 }

307   str2 := 'abcdefghijklmnopqrstuvwxyz'; { 字符a~z }

308   str3 := 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'; { 字符A~Z }

309   str := str + str1 + str2 + str3;

310   for i := 0 to StrLength - 1 do { 生成的字符长度 }

311   begin

312     case rType of

313       0:

314         reslt1 := reslt1 + str1[Random(Length(str1) - 1) + 1]; // 纯数字

315       1:

316         reslt1 := reslt1 + str2[Random(Length(str2) - 1) + 1]; // 纯小写字母

317       2:

318         reslt1 := reslt1 + str3[Random(Length(str3) - 1) + 1]; // 纯大写字母

319       3:

320         reslt1 := reslt1 + str[Random(Length(str) - 1) + 1]; // 数字字母混合

321     end;

322   end;

323   Result := reslt1;

324 end;

325 

326 procedure RunGame(GamePath: string);

327 begin

328   // path = "D:\Administrator\Documents\Games\完美世界国际版\element\elementclient.exe"

329   if not FileExists(GamePath) then

330   begin

331     Application.MessageBox('文件不存在' + #13#10,

332       '请将登录器放在游戏目录下', MB_OK + MB_ICONERROR);

333   end

334   else

335   begin

336     ShellExecute(Application.Handle, 'open', PChar(GamePath), PChar(' game:cpw'),

337       PChar(ExtractFilePath(GamePath)), SW_SHOW);

338   end;

339 end;

340 

341 

342 procedure TForm1.Button1Click(Sender: TObject);

343 var

344   h: Hwnd;

345 begin

346   h := FindWindow('ElementClient Window', PChar(ComboBox1.Text));

347   SetWindowText(h, PChar(Edit1.Text));

348 end;

349 

350 procedure TForm1.Button2Click(Sender: TObject);

351 begin

352   Edit1.Text := GeneralPwd(5, 3);

353 end;

354 

355 procedure TForm1.Button3Click(Sender: TObject);

356 begin

357   WriteConfig;

358   RunGame(ComboBox4.Text);

359 end;

360 

361 procedure TForm1.FormCreate(Sender: TObject);

362 begin

363   Edit1.Text := GeneralPwd(5, 3);

364   CreateIniFile;

365   ReadConfig;

366   Application.HintHidePause := 10000;

367   InstallHotKey;

368   Height:=161

369 

370 

371 

372 end;

373 

374 procedure TForm1.FormClose(Sender: TObject; var Action: TCloseAction);

375 begin

376   WriteConfig;

377   UnInstallHotKey;

378 

379 end;

380 

381 procedure TForm1.Button4Click(Sender: TObject);

382 begin

383   with TOpenDialog.Create(nil) do

384   begin

385     Filter := 'elementclient.exe|*.exe';

386     FileName := 'elementclient.exe';

387     if Execute then

388       ComboBox4.Text := FileName;

389     if FileExists(FileName) then

390       ComboBox4.Items.Add(FileName);

391   end;

392 end;

393 

394 procedure TForm1.Button5Click(Sender: TObject);

395 begin

396   ComboBox4.DeleteSelected;

397   ComboBox4.ItemIndex := 0;

398 end;

399 

400 procedure TForm1.TrayIcon1Click(Sender: TObject);

401 begin

402   Visible := not Visible;

403 end;

404 

405 procedure TForm1.Close1Click(Sender: TObject);

406 begin

407   Close;

408 end;

409 

410 procedure TForm1.Update1Click(Sender: TObject);

411 begin

412   ShellExecute(Handle, 'open', 'http://www.cnblogs.com/xe2011/p/3500516.html ', nil, nil, SW_SHOW);

413 end;

414 

415 procedure swap(x, y: string);

416 var

417   temp: string;

418 begin

419   temp := x;

420   x := y;

421   y := temp;

422 end;

423 

424 procedure TForm1.Button6Click(Sender: TObject);

425 var a, b: string;

426 begin

427   a := ComboBox1.Text;

428   b := Edit1.Text; {赋值}

429   swap(a, b); {数值对换}

430   Edit1.Text := a; {读取数值}

431   ComboBox1.Text := b;

432 end;

433 

434 

435 

436 

437 procedure TForm1.btnStopClick(Sender: TObject);

438 begin

439   btnStop.Enabled := False;

440   btnStart.Enabled := True;

441   Timer1.Enabled := False;

442   ComboBox5.Enabled := true;

443 end;

444 

445 procedure TForm1.btnStartClick(Sender: TObject);

446 begin

447   btnStop.Enabled := True;

448   btnStart.Enabled := False;

449   Timer1.Enabled := True;

450   ComboBox5.Enabled := False;

451 end;

452 

453 procedure TForm1.Button7Click(Sender: TObject);

454 begin

455   Hide;

456   ShowMessage('将光标放在你要点的位置,然后使用快捷键' + #13#10 + '开始  Ctrl+Alt+X' + #13#10 + '停止  Ctrl+Alt+C');

457   Show;

458 end;

459 

460 procedure TForm1.ComboBox5Change(Sender: TObject);

461 begin

462   Timer1.Interval := StrToInt(ComboBox5.Text);

463 end;

464 

465 var

466   count: Integer = 0;

467 

468 procedure TForm1.Timer1Timer(Sender: TObject);

469 begin

470   mouse_event(MOUSEEVENTF_LEFTDOWN, 0, 0, 0, 0); // 按下

471   mouse_event(MOUSEEVENTF_LEFTUP, 0, 0, 0, 0); //弹起

472   Inc(count);

473   Label7.Caption := Format('单击了 %d 次', [count]);

474 end;

475 

476 

477 //按键模拟

478 

479 function TForm1.SendKey(Str: string): Integer;

480 var

481   h: HWND;

482   KeyValue: integer;

483 begin

484   {功能模拟发送按键:1~9,F1~F9}

485   h := FindWindow('ElementClient Window', nil);

486   if Str = '1' then KeyValue := 49;

487   if Str = '2' then KeyValue := 50;

488   if Str = '3' then KeyValue := 51;

489   if Str = '4' then KeyValue := 52;

490   if Str = '5' then KeyValue := 53;

491   if Str = '6' then KeyValue := 54;

492   if Str = '7' then KeyValue := 55;

493   if Str = '8' then KeyValue := 56;

494   if Str = '9' then KeyValue := 57;

495   if Str = 'F1' then KeyValue := VK_F1;

496   if Str = 'F2' then KeyValue := VK_F2;

497   if Str = 'F3' then KeyValue := VK_F3;

498   if Str = 'F4' then KeyValue := VK_F4;

499   if Str = 'F5' then KeyValue := VK_F5;

500   if Str = 'F6' then KeyValue := VK_F6;

501   if Str = 'F7' then KeyValue := VK_F7;

502   if Str = 'F8' then KeyValue := VK_F8;

503   if Str = 'F9' then KeyValue := VK_F9;

504   if Str = 'Tab' then KeyValue := VK_TAB;

505 

506   Sendmessage(h, Wm_Keydown, KeyValue, 0);

507   Sendmessage(h, Wm_Keyup, KeyValue, 0);

508 end;

509 

510 

511 

512 procedure TForm1.Button9Click(Sender: TObject);

513 begin

514   Hide;

515   ShowMessage('如果游戏多开的,这只会对当前激活的游戏窗口有效');

516   Show;

517 end;

518 

519 procedure TForm1.TimerKey1Timer(Sender: TObject);

520 begin

521   SendKey(cbbKey1.Text);

522 end;

523 

524 procedure TForm1.CheckBox1Click(Sender: TObject);

525 begin

526   if CheckBox1.Checked then

527   begin

528     EditKey1.Enabled := false;

529     cbbKey1.Enabled := false;

530     TimerKey1.Enabled := true;

531     TimerKey1.Interval := StrToInt(EditKey1.Text) * 1000;

532   end

533   else

534   begin

535     EditKey1.Enabled := True;

536     cbbKey1.Enabled := True;

537     TimerKey1.Enabled := false;

538   end;

539 end;

540 

541 procedure TForm1.TimerKey2Timer(Sender: TObject);

542 begin

543   SendKey(cbbKey2.Text);

544 end;

545 

546 procedure TForm1.TimerKey3Timer(Sender: TObject);

547 begin

548   SendKey(cbbKey3.Text);

549 end;

550 

551 procedure TForm1.TimerKey4Timer(Sender: TObject);

552 begin

553   SendKey(cbbKey4.Text);

554 end;

555 

556 procedure TForm1.TimerKey5Timer(Sender: TObject);

557 begin

558   SendKey(cbbKey5.Text);

559 end;

560 

561 procedure TForm1.CheckBox2Click(Sender: TObject);

562 begin

563   if CheckBox2.Checked then

564   begin

565     EditKey2.Enabled := false;

566     cbbKey2.Enabled := false;

567     TimerKey2.Enabled := true;

568     TimerKey2.Interval := StrToInt(EditKey2.Text) * 1000;

569   end

570   else

571   begin

572     EditKey2.Enabled := True;

573     cbbKey2.Enabled := True;

574     TimerKey2.Enabled := false;

575   end;

576 end;

577 

578 procedure TForm1.CheckBox3Click(Sender: TObject);

579 begin

580   if CheckBox3.Checked then

581   begin

582     EditKey3.Enabled := false;

583     cbbKey3.Enabled := false;

584     TimerKey3.Enabled := true;

585     TimerKey3.Interval := StrToInt(EditKey3.Text) * 1000;

586   end

587   else

588   begin

589     EditKey3.Enabled := True;

590     cbbKey3.Enabled := True;

591     TimerKey3.Enabled := false;

592   end;

593 end;

594 

595 procedure TForm1.CheckBox4Click(Sender: TObject);

596 begin

597   if CheckBox4.Checked then

598   begin

599     EditKey4.Enabled := false;

600     cbbKey4.Enabled := false;

601     TimerKey4.Enabled := true;

602     TimerKey4.Interval := StrToInt(EditKey4.Text) * 1000;

603   end

604   else

605   begin

606     EditKey4.Enabled := True;

607     cbbKey4.Enabled := True;

608     TimerKey4.Enabled := false;

609   end;

610 end;

611 

612 procedure TForm1.CheckBox5Click(Sender: TObject);

613 begin

614   if CheckBox5.Checked then

615   begin

616     EditKey5.Enabled := false;

617     cbbKey5.Enabled := false;

618     TimerKey5.Enabled := true;

619     TimerKey5.Interval := StrToInt(EditKey5.Text) * 1000;

620   end

621   else

622   begin

623     EditKey5.Enabled := True;

624     cbbKey5.Enabled := True;

625     TimerKey5.Enabled := false;

626   end;

627 end;

628 

629 procedure TForm1.chkSelectAllClick(Sender: TObject);

630 begin

631   CheckBox1.Checked := chkSelectAll.Checked;

632   CheckBox2.Checked := chkSelectAll.Checked;

633   CheckBox3.Checked := chkSelectAll.Checked;

634   CheckBox4.Checked := chkSelectAll.Checked;

635   CheckBox5.Checked := chkSelectAll.Checked;

636   CheckBox6.Checked := chkSelectAll.Checked;

637   CheckBox7.Checked := chkSelectAll.Checked;

638   CheckBox8.Checked := chkSelectAll.Checked;

639   CheckBox9.Checked := chkSelectAll.Checked;

640 end;

641 

642 procedure TForm1.FormShow(Sender: TObject);

643 begin

644   ShowWindow(Application.Handle, SW_HIDE);

645 end;

646 

647 procedure TForm1.CheckBox6Click(Sender: TObject);

648 begin

649   if CheckBox6.Checked then

650   begin

651     EditKey6.Enabled := false;

652     cbbKey6.Enabled := false;

653     TimerKey6.Enabled := true;

654     TimerKey6.Interval := StrToInt(EditKey6.Text) * 1000;

655   end

656   else

657   begin

658     EditKey6.Enabled := True;

659     cbbKey6.Enabled := True;

660     TimerKey6.Enabled := false;

661   end;

662 end;

663 

664 procedure TForm1.CheckBox7Click(Sender: TObject);

665 begin

666   if CheckBox7.Checked then

667   begin

668     EditKey7.Enabled := false;

669     cbbKey7.Enabled := false;

670     TimerKey7.Enabled := true;

671     TimerKey7.Interval := StrToInt(EditKey7.Text) * 1000;

672   end

673   else

674   begin

675     EditKey7.Enabled := True;

676     cbbKey7.Enabled := True;

677     TimerKey7.Enabled := false;

678   end;

679 end;

680 

681 procedure TForm1.CheckBox8Click(Sender: TObject);

682 begin

683   if CheckBox8.Checked then

684   begin

685     EditKey8.Enabled := false;

686     cbbKey8.Enabled := false;

687     TimerKey8.Enabled := true;

688     TimerKey8.Interval := StrToInt(EditKey8.Text) * 1000;

689   end

690   else

691   begin

692     EditKey8.Enabled := True;

693     cbbKey8.Enabled := True;

694     TimerKey8.Enabled := false;

695   end

696 end;

697 

698 procedure TForm1.CheckBox9Click(Sender: TObject);

699 begin

700  if CheckBox9.Checked then

701   begin

702     EditKey9.Enabled := false;

703     cbbKey9.Enabled := false;

704     TimerKey9.Enabled := true;

705     TimerKey9.Interval := StrToInt(EditKey9.Text) * 1000;

706   end

707   else

708   begin

709     EditKey9.Enabled := True;

710     cbbKey9.Enabled := True;

711     TimerKey9.Enabled := false;

712   end

713 end;

714 

715 procedure TForm1.TimerKey6Timer(Sender: TObject);

716 begin

717 SendKey(cbbKey6.Text);

718 end;

719 

720 procedure TForm1.TimerKey7Timer(Sender: TObject);

721 begin

722 SendKey(cbbKey7.Text);

723 end;

724 

725 procedure TForm1.TimerKey8Timer(Sender: TObject);

726 begin

727 SendKey(cbbKey8.Text);

728 end;

729 

730 procedure TForm1.TimerKey9Timer(Sender: TObject);

731 begin

732 SendKey(cbbKey9.Text);

733 end;

734 

735 procedure TForm1.PageControl1Change(Sender: TObject);

736 begin

737     case PageControl1.TabIndex of

738       0: Height:=161  ;

739       1: Height:=161 ;

740       2: Height:=313 ;

741       3: Height:=161  ;

742     end;

743 end;

744 

745 

746 

747 //

748 // ------------------------------------------------------------------------------

749 procedure TForm1.SetIcon1;

750 begin

751   Form1.Image1.Picture:=Image2.Picture;

752 

753 end;

754 

755 procedure TForm1.SetIcon2;

756 begin

757   Form1.Image1.Picture:=Image3.Picture;

758 end;

759 

760 procedure TForm1.SetMyCursor;

761 var

762   h: HCURSOR;

763 begin

764   h := LoadCursor(HInstance, 'DragCursor');

765   SetSystemCursor(h, ocr_normal);

766 end;

767 

768 procedure TForm1.RestoreCursor;

769 begin

770   SystemParametersinfo(SPI_SETCURSORS, 0, nil, SPIF_SENDCHANGE);

771 end;

772 

773 procedure TForm1.SetLabelTimerProEnable;

774 begin

775   LabelPosition.Caption := '';

776   LabelPosition.Visible := True;

777   TimerValue1.Enabled := True;

778 end;

779 

780 procedure TForm1.SetLabelTimerProDisable;

781 begin

782   LabelPosition.Visible := False;

783   TimerValue1.Enabled := False;

784 end;

785 

786 

787 

788 

789 //

790 procedure TForm1.Image1MouseDown(Sender: TObject; Button: TMouseButton;

791   Shift: TShiftState; X, Y: Integer);

792 begin

793   SetIcon2;

794   SetMyCursor;

795   SetLabelTimerProEnable;

796 end;

797 

798 procedure TForm1.Image1MouseUp(Sender: TObject; Button: TMouseButton;

799   Shift: TShiftState; X, Y: Integer);

800 begin

801   SetIcon1;

802   RestoreCursor;

803   SetLabelTimerProDisable;

804 end;

805 

806 procedure TForm1.TimerValue1Timer(Sender: TObject);

807 var

808   h: HWND;

809   p: TPoint;

810   Rec: TRect;

811   sClassName, sWindowText: array [0 .. 254] of Char;

812 begin

813   GetCursorPos(p);

814   LabelPosition.Caption := Format('%d,%d', [p.X, p.Y]);

815   h := WindowFromPoint(p);

816   GetClassName(h, sClassName, SizeOf(sClassName));

817   GetWindowText(h, sWindowText, SizeOf(sClassName));

818 

819   Edit1.Text := sWindowText;

820 end;

821 

822 end.
代码

 

你可能感兴趣的:(工具)