操作内存引出的问题~~求解!请高手指教~!
下面是照一个教程做的代码,请高手指教一下我如果要把得到的数据显示出来应该怎么办!!
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;
type
TForm1 = class(TForm)
Button1: TButton;
Memo1: TMemo;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
Resource: array[1..7] of dword;//这一段不明白什么意思!!?
implementation
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
const
ResourceOffset: dword = $004DF788;//是把内存地址赋给ResourceOffset吧?
var
hw: HWND;
pid: dword;
h: THandle;
tt: Cardinal;
begin
hw := FindWindow('计算器', nil);
if hw = 0 then
ShowMessage('1');
GetWindowThreadProcessId(hw, @pid);
h := OpenProcess(PROCESS_ALL_ACCESS, false, pid);
if h = 0 then
ReadProcessMemory(h,Pointer(ResourceOffset),
@Resource,
20,
tt);
在这想把 Resource 中的数值显示到 Memo 组件中,应该怎么做!??
CloseHandle(h);
end;
end.
论坛上有关操作内存的文章我都看了,那些方法我编译不通过!!不明为什么中!!以上的通过又不知怎么读出来.