📄 mainunit.pas
字号:
TempRecord:TLockRecord;
TempSize:Integer;
TempSaveSignHead:string[$30];
begin
if LockNum=MaxLockNum then
begin
Showmessage(Format(String_maxLockNum,[MaxLockNum]));
Exit;
end;
if openLockRecordDialog.Execute then
begin
try
begin///try begin
OpenStream:=TFileStream.Create(OpenLockRecordDialog.FileName,fmOpenRead or fmShareDenyNOne);
TempSize:=(OpenStream.Size-sizeof(String_GPSAVE)) div sizeof(TempRecord);
if (TempSize<=0) then
begin
showmessage(String_invalidSave);
Exit;
end;
/////////////注意载入/////////
try
OpenStream.ReadBuffer(TempSaveSignHead,sizeof(String_GPSAVE));
except
showmessage(String_invalidSave);
exit;
end;
if TempSaveSignHead<>String_GPSAVE then
begin
showmessage(String_invalidSave);
exit;
end;
for i:=1 to TempSize do
begin
if LockNum=MaxLockNum then
begin
Showmessage(Format(String_maxLockNum,[MaxLockNum]));
Exit;
end;
try
OpenStream.ReadBuffer(TempRecord,sizeof(TempRecord));
except
showmessage(String_invalidSave);
exit;
end;
for j:=1 to MaxLockNum do if memLockRecord[j].Applyed=False then Break;
try
with memLockRecord[j] do
begin
Description:=TempRecord.Description;
Address:=TempRecord.Address;
valueStr:=TempRecord.valueStr;
VarType:=TempRecord.VarType; ///这些都在 Found_LVMouseDown
ProcessID:=CurrentProcessID;
Frozen:=True;
//Applyed:=true; //运用/闲置标志
end;
Except
showmessage(String_invalidSave);
exit;
end;
Lock_Enable:=False;
Inc(LockNum);
MemLockRecord[j].Applyed:=True;
ListToLockIndex[LockNum]:=j;
with Lock_LV.Items.add do
begin
Caption:='';
Subitems.Add('');
Subitems.Add('');
Subitems.Add('');
Subitems.Add('');
Subitems.Add('');
end;
UpdateLockInfo(j,LockNum-1);
Lock_Enable:=True;
end;///循环读取结束
end;////try end
finally
FreeAndNil(OpenStream);
end;
end; //opendioalog
end;
procedure TMainForm.Lockcopy_memuClick(Sender: TObject);
var theIndex:integer;
begin
if Lock_lv.Selected<>nil then
begin
theIndex:=ListToLockIndex[Lock_lv.Selected.Index+1];
CopyLockRecord:=MemLockRecord[theIndex];
CanPasteLockRecord:=true;
end;
end;
procedure TMainForm.Lockpaste_menuClick(Sender: TObject);
var I:integer;
begin
if not CanPasteLockRecord then exit;
if LockNum>=MaxLockNum then
begin
Showmessage(Format(String_maxLockNum,[MaxLockNum]));
Exit;
end;
Lock_Enable:=false;
for i:=1 to MaxLockNum do
if memLockRecord[i].Applyed=False then Break;
Inc(LockNum);
MemLockRecord[i].Applyed:=True;
ListToLockIndex[LockNum]:=i;
memLockRecord[i]:=CopyLockRecord;
with Lock_LV.Items.add do
begin
Caption:='';
Subitems.Add('');
Subitems.Add('');
Subitems.Add('');
Subitems.Add('');
Subitems.Add('');
end;
UpdateLockInfo(i,LockNum-1);
Lock_Enable:=true;
end;
procedure TMainForm.Set_1_RB1Click(Sender: TObject);
begin
set_FromEdit.Enabled:=False;
set_ToEdit.Enabled:=False;
set_FromEdit.Text:='00010000';
set_ToEdit.Text:='86500000';
end;
procedure TMainForm.Set_1_RB2Click(Sender: TObject);
begin
set_FromEdit.Enabled:=False;
set_ToEdit.Enabled:=False;
set_FromEdit.Text:='00040000';
set_ToEdit.Text:='6DA00000';
end;
procedure TMainForm.Set_1_RB3Click(Sender: TObject);
begin
set_FromEdit.Enabled:=False;
set_ToEdit.Enabled:=False;
set_FromEdit.Text:='80100000';
set_ToEdit.Text:='86500000';
end;
procedure TMainForm.Set_1_RB4Click(Sender: TObject);
begin
set_FromEdit.Enabled:=True;
set_ToEdit.Enabled:=True;
end;
procedure TMainForm.Lock_TrackBarChange(Sender: TObject);
begin
Lock_Frequency_LB.Caption:=intToStr(Lock_TrackBar.Position*100)+' ms';
end;
procedure TMainForm.MyFavorite_TBClick(Sender: TObject);
begin
MainPageControl.ActivePage:=MyFavorites_TS;
GPOptions.WhichPage:=1;
end;
procedure TMainForm.MemEdit_TBClick(Sender: TObject);
begin
MainPageControl.ActivePage:=MemoryScan_TS;
GPOptions.WhichPage:=2;
end;
procedure TMainForm.archiveEdit_TBClick(Sender: TObject);
begin
MainPageControl.ActivePage:=ArchiveEdit_TS;
GPOptions.WhichPage:=3;
end;
procedure TMainForm.CapPic_TBClick(Sender: TObject);
begin
MainPageControl.ActivePage:=CapPic_TS;
GPOptions.WhichPage:=4;
end;
procedure TMainForm.SetOptions_TBClick(Sender: TObject);
begin
MainPageControl.ActivePage:=Set_ts;
GPOptions.WhichPage:=6;
end;
procedure TMainForm.Help_TBClick(Sender: TObject);
var theAdd:OleVariant;
begin
MainPageControl.ActivePage:=Help_TS;
GPOptions.WhichPage:=7;
if HelpWebBrowserForm=nil then
begin
HelpWebBrowserForm:=THelpWebBrowserForm.Create(Application,Help_TS);
HelpWebBrowserForm.Show;
theAdd:='mk:@MSITStore:'+Apppath+'GPHelp.chm::/index.html';
///ms-its:C:\i386\CALC.CHM::/calc_scientific.htm
HelpWebBrowserForm.WebBrowser1.Navigate2(theAdd);
end;
end;
procedure TMainForm.backtogame_bnClick(Sender: TObject);
var winhandle:HWND;
winprocess: Dword;
begin
winhandle:=GetWindow(GetForeGroundWindow,GW_HWNDFIRST);
while winhandle<>0 do
begin
if isWindowvisible(winhandle) then
begin
GetWindowThreadProcessId(winhandle,@winprocess);
if winprocess=CurrentProcessID then
begin
SetActiveWindow(winhandle);
DefWindowProc(winhandle, WM_SYSCOMMAND, SC_RESTORE, 0);
SetForegroundWindow(winhandle);
Exit;
end;
end;
winhandle:=GetWindow(winhandle,GW_HWNDNEXT);
end;
end;
procedure TMainForm.tray_minClick(Sender: TObject);
begin
MainForm.Hide;
end;
procedure TMainForm.DisplayProcessTimer(Sender: TObject);
begin
if taskNum=0 then exit;
with thetask[CurrentTaskIndex] do
begin
if (Scan_Gauge.MaxValue<>Int(totalProcess)) then Scan_Gauge.MaxValue:=TotalProcess;
Scan_Gauge.Progress:=NowProcess;
///只有在扫描过程中更新
UpdateTaskInfo(CurrentTaskIndex);
/////////////
if CanUpdateTask=IDOK then
begin
AddFoundToListView(CurrentTaskIndex);
CanUpdateTask:=-999;
end;
end;
end;
procedure TMainForm.GameRecord_TBClick(Sender: TObject);
begin
MainPageControl.ActivePage:=GameRecord_TS;
GPOptions.WhichPage:=5;
end;
procedure TMainForm.Options_TreeViewClick(Sender: TObject);
begin
Options_PageControl.ActivePageIndex:=Options_treeView.Selected.Index;
GPOptions.setActivePage:=Options_PageControl.ActivePageIndex+1;
end;
function TMainForm.ShortCutToHotKey_Mode(Value: TShortCut):UINT;
begin
Result:=0;
if Value and scCtrl <> 0 then Result:=Result or MOD_CONTROL;
if Value and scAlt <> 0 then Result:=Result or MOD_ALT;
if Value and scShift <> 0 then Result:=Result or MOD_SHIFT;
end;
function TMainForm.HotKeyToShortCut(mode,value:UINT):TShortCut;
begin
Result:=0;
if mode and MOD_CONTROL <>0 then Result:=Result or scCtrl;
if mode and MOD_ALT <>0 then Result:=Result or scAlt;
if mode and MOD_SHIFT <>0 then Result:=Result or scShift;
Result:=Result or value;
end;
function TMainForm.ShortCutToHotKey_value(Value: TShortCut):UINT;
begin
result:=Value and $00FF;
end;
procedure TMainForm.Set_1_OKClick(Sender: TObject);
var TempDword1,TempDword2:Dword;
Ecode:integer;
TempMainHotKey_mode:UINT;
TempMainHotKey_value:UINT;
begin
///搜索地址//////
val('$'+set_FromEdit.Text,TempDword1,Ecode);
if Ecode>0 then
begin
beep;
set_FromEdit.SelectAll;
exit;
end;
val('$'+set_ToEdit.Text,TempDword2,Ecode);
if Ecode>0 then
begin
beep;
set_ToEdit.SelectAll;
exit;
end;
if TempDword1>TempDword2 then
begin
beep;
set_ToEdit.SelectAll;
exit;
end;
TempMainHotKey_mode:=ShortCutToHotKey_Mode(Main_HotKey.HotKey);
TempMainHotKey_value:=ShortCutToHotKey_Value(Main_HotKey.HotKey);
UnRegisterhotkey(MainForm.handle,hotkeyid_Main);
if not RegisterHotkey(MainForm.handle,hotkeyid_Main,TempMainHotKey_mode,TempMainHotKey_value)then
raise Exception.Create(String_NotSethotkey1);
if Set_1_Rb1.Checked then GPOptions.ScanAddressMode:=1 else
if Set_1_Rb2.Checked then GPOptions.ScanAddressMode:=2 else
if Set_1_Rb3.Checked then GPOptions.ScanAddressMode:=3 else
if Set_1_Rb4.Checked then GPOptions.ScanAddressMode:=4 ;
GPOptions.DefaultFromAddress:=TempDword1;
GPOptions.DefaultToAddress:= TempDword2;
GPKernel.DefaultFromAddress:=GPOptions.DefaultFromAddress;
GPKernel.DefaultToAddress:=GPOptions.DefaultToAddress;
GPOptions.Lock_Interval:=Lock_TrackBar.Position*100;
GPOptions.MainHotKey_mode:=TempMainHotKey_mode;
GPOptions.MainHotKey_value:=TempMainHotKey_value;
Showmessage(string_setok);
end;
procedure TmainForm.SaveOptions;
var TheFile:TFileStream;
begin
TheFile:=TFileStream.Create(Apppath+'GPOptions.dat',fmCreate or fmOpenReadWrite or fmshareDenynone);
try
TheFile.WriteBuffer(GPOptions,sizeof(GPOptions));
finally
FreeAndNil(TheFile);
end;
end;
procedure TMainForm.FormClose(Sender: TObject; var Action: TCloseAction);
begin
GPOptions.FormWidth:=Mainform.Width;
GPOptions.FOrmHeigth:=Mainform.Height;
SaveOptions;
DeleteAtom(HotKeyID_Main);
DeleteAtom(HotKeyID_Capture);
end;
procedure TMainForm.Set_2_okClick(Sender: TObject);
var TempCaptureHotKey_mode:UINT;
TempCaptureHotKey_value:UINT;
begin
if SaveMode1.Checked then GPOptions.CaptureSaveMode:=1 else
if SaveMode2.Checked then GPOptions.CaptureSaveMode:=2 else
if SaveMode3.Checked then GPOptions.CaptureSaveMode:=3 ;
GPOptions.CaptureSavePath:=Copy(CaptureSavepath_Edit.Text,1,255);
TempCaptureHotKey_mode:=ShortCutToHotKey_Mode(Capture_HotKey.HotKey);
TempCaptureHotKey_value:=ShortCutToHotKey_Value(Capture_HotKey.HotKey);
UnRegisterhotkey(CapturePicForm.handle,hotkeyid_Capture);
if not RegisterHotkey(CapturePicForm.handle,hotkeyid_Capture,TempCaptureHotKey_mode,TempCaptureHotKey_value)then
raise Exception.Create(String_NotSethotkey2);
GPOptions.CaptureHotKey_mode:=TempCaptureHotKey_mode;
GPOptions.CaptureHotKey_value:=TempCaptureHotKey_value;
Showmessage(string_setok);
end;
procedure TMainForm.EnabledAlphaBlend_cbClick(Sender: TObject);
begin
if EnabledAlphaBlend_cb.State=cbChecked then
GpOptions.AlphaBlend:=1 else GpOptions.AlphaBlend:=0;
if GpOptions.AlphaBlend=0 then MainForm.AlphaBlend:=False else
begin
MainForm.AlphaBlend:=True;
MainForm.AlphaBlendValue:= GpOptions.AlphaBlendValue;
end;
end;
procedure TMainForm.Alphablend_TrackBarChange(Sender: TObject);
begin
GpOptions.AlphaBlendValue:=Alphablend_TrackBar.Position;
if GpOptions.AlphaBlend=1 then MainForm.AlphaBlendValue:= GpOptions.AlphaBlendValue;
end;
procedure TMainForm.set_autoRunClick(Sender: TObject);
var
Reg:Tregistry;
begin
Reg:=Tregistry.Create;
Reg.Rootkey:= HKEY_LOCAL_MACHINE;
Reg.OpenKey('SOFTWARE\Microsoft\Windows\CurrentVersion\Run',False);
if (reg.ReadString('GamePaladin')=application.exename)and (set_autoRun.Checked=false)then
Reg.WriteString('GamePaladin','')
else if (set_autoRun.Checked=true) then
Reg.WriteString('GamePaladin',application.exename);
Reg.CloseKey;
Reg.Free;
end;
procedure TMainForm.MakeappshortcutClick(Sender: TObject);
var
tmpObject : IUnknown;
tmpSLink:IShellLink;
tmpPFile : IPersistFile;
PIDL : PItemIDList;
StartupDirectory : array[0..MAX_PATH] of Char;
StartupFilename : String;
LinkFilename : WideString;
begin
StartupFilename:=ParamStr(0);
tmpObject := CreateComObject(CLSID_ShellLink);//创建建立快捷方式的外壳扩展
tmpSLink := tmpObject as IShellLink;//取得接口
tmpPFile := tmpObject as IPersistFile;//用来储存*.lnk文件的接口
tmpSLink.SetPath(pChar(StartupFilename));//设定notepad.exe所在路径
tmpSLink.SetWorkingDirectory(pChar(ExtractFilePath(StartupFilename)));//设定工作目录
SHGetSpecialFolderLocation(0,CSIDL_DESKTOPDIRECTORY,PIDL);//获得桌面的Itemidlist
SHGetPathFromIDList(PIDL,StartupDirectory);//获得桌面路径
LinkFilename := StartupDirectory + '\GamePaladin.lnk';
tmpPFile.Save(pWChar(LinkFilename),FALSE);//保存*.lnk文件
end;
procedure TMainForm.About1Click(Sender: TObject);
begin
RegisterForm:=TregisterForm.Create(self);
RegisterForm.ShowModal;
FreeandNil(RegisterForm);
end;
procedure TMainForm.path_bnClick(Sender: TObject);
var path:String;
begin
if SelectDir(Handle,'',path) then
CaptureSavepath_Edit.Text:=path;
end;
procedure TMainForm.Homepage1Click(Sender: TObject);
begin
shellexecute(application.Handle,
pchar('open'),
pchar('http://www.AdvNetsoft.com'),
nil,
nil,
SW_SHOWNORMAL);
end;
procedure TMainForm.Support1Click(Sender: TObject);
begin
shellexecute(application.Handle,
pchar('open'),
pchar('mailto:support@AdvNetsoft.com'),
nil,
nil,
SW_SHOWNORMAL);
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -