有没有整理内存的组件???(100分)

  • 主题发起人 主题发起人 gf.z
  • 开始时间 开始时间
G

gf.z

Unregistered / Unconfirmed
GUEST, unregistred user!
可以做到想turbomen(一个内存整理软件)一样的内存整理效果!!
 
一个很小巧的内存整理程序源码,很有参考价值:
http://www.playicq.com/databack/memdef2.zip
 
unit MemCheater;

interface

uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
ExtCtrls;

type
TMemCheater = class(TComponent)
private
FValue : Integer;
FWindowTitle : PChar;
FAddress : Integer;
protected
{ Protected declarations }

published public
Procedure UpdateMemory;
Property Address : Integer read FAddress write FAddress;
Property Value : Integer read FValue write FValue;
Property WindowTitle : PChar read FWindowTitle write FWindowTitle;

end;


Var WindowName : integer;
ProcessId : integer;
ThreadId : integer;
buf : PChar;
HandleWindow : Integer;
write : cardinal;
wWindowTitle: pchar;
Address :integer;
PokeValue :integer;
NumberOfBytes: integer;

procedure Register;

implementation

procedure Register;
begin
RegisterComponents('JPSoft', [TMemCheater]);
end;

Procedure TMemCheater.UpdateMemory;
begin
wwindowtitle:= FWindowTitle;
address := FAddress;
pokevalue := FValue;
numberofbytes := 1;
WindowName := FindWindow(nil,wWindowTitle);
If WindowName = 0 then
begin
MessageDlg('The game must be running in the background. Run it now, and then try again.', mtwarning,[mbOK],0);
end;

ThreadId := GetWindowThreadProcessId(WindowName,@ProcessId);
HandleWindow := OpenProcess(PROCESS_ALL_ACCESS,False,ProcessId);

GetMem(buf,1);
buf^ := Chr(PokeValue);
WriteProcessMemory(HandleWindow,ptr(Address),buf,NumberOfBytes,write);
FreeMem(buf);
closehandle(HandleWindow);
end;

end.

 
后退
顶部