扫扫扫
Posted onlyou13
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了扫扫扫相关的知识,希望对你有一定的参考价值。
procedure TForm1.Button1Click(Sender: TObject); var hGame: THandle; pid, ProcessID: Cardinal; readCount: Cardinal; arrByte:array[0..1023] of Byte; gWidth, gHeight: Integer; totalBytes: Integer; x, y: Integer; index: Byte; str, str2: string; begin RichEdit1.Clear; str := ‘‘; hGame := FindWindow(‘扫雷‘, ‘扫雷‘); if hGame > 0 then begin RichEdit1.Lines.Add(‘游戏句柄:‘ + IntToStr(hGame)); GetWindowThreadProcessId(hGame, pid); RichEdit1.Lines.Add(‘游戏PID:‘ + IntToStr(pid)); ProcessID:=OpenProcess(PROCESS_ALL_ACCESS,False,PID); // 打开进程 RichEdit1.Lines.Add(‘游戏ProcessID:‘ + IntToStr(ProcessID)); ReadProcessMemory(ProcessID, Pointer(16798520), @gHeight, SizeOf(gHeight), readCount); RichEdit1.Lines.Add(‘游戏高度:‘ + IntToStr(gHeight)); ReadProcessMemory(ProcessID, Pointer(16798516), @gWidth, SizeOf(gWidth), readCount); RichEdit1.Lines.Add(‘游戏宽度:‘ + IntToStr(gWidth)); totalBytes := 765;//gHeight * 32; ZeroMemory(@arrByte[0], SizeOf(arrByte)); ReadProcessMemory(ProcessID, Pointer(16798561), @arrByte, totalBytes, readCount); RichEdit1.Lines.Add(‘读取内存字节数:‘ + IntToStr(readCount)); for y := 0 to gHeight - 1 do begin str2 := ‘‘; for x := 0 to gWidth - 1 do begin index := x + y * 32; if arrByte[index] <> $8F then begin str := str + ‘0 ‘; str2 := str2 + IntToHex(arrByte[index], 2) + ‘ ‘; SendMessage(hGame, WM_LBUTTONDOWN, 0, MakeLParam(20 + x * 16, 62 + y * 16)); SendMessage(hGame, WM_LBUTTONUP, 0, MakeLParam(20 + x * 16, 62 + y * 16)); end else begin str := str + ‘X ‘; str2 := str2 + ‘8F ‘; end; end; str := str + ‘ ‘ + str2 + #13; end; RichEdit1.Lines.Add(str); end else ShowMessage(‘没有打开游戏‘); end;
以上是关于扫扫扫的主要内容,如果未能解决你的问题,请参考以下文章