学
学习DELPHI
Unregistered / Unconfirmed
GUEST, unregistred user!
var<br>WindowName : integer;<br>ProcessId : integer;<br>ThreadId : integer;<br>buf : PChar;<br>HandleWindow : Integer;<br>write : cardinal;<br>const<br>WindowTitle = 'aaa';<br>Address = $3212321;<br>PokeValue = $2121;<br>NumberOfBytes = 2;<br>begin<br>WindowName := FindWindow(nil,WindowTitle);<br>If WindowName = 0 then<br>begin<br>MessageDlg('Game not running! Please run it and try again!', mtwarning,[mbOK],0);<br>end;<br><br>ThreadId := GetWindowThreadProcessId(WindowName,@ProcessId);<br>HandleWindow := OpenProcess(PROCESS_ALL_ACCESS,False,ProcessId);<br>GetMem(buf,1);<br>buf^ := Chr(PokeValue);<br>WriteProcessMemory(HandleWindow,ptr(Address),buf,NumberOfBytes,write);<br>FreeMem(buf);<br>closehandle(HandleWindow);<br><br>end;<br><br><br><br>-=-=-=-=-=-=-=-=-=-=-这四句重点-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-<br>GetMem(buf,1);<br>buf^ := Chr(PokeValue);<br>WriteProcessMemory(HandleWindow,ptr(Address),buf,NumberOfBytes,write);<br>FreeMem(buf);<br>-=-=-=-=-=-=-==-=-=-==-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=<br><br><br><br>