有点小问题,高手来帮帮忙看看~
procedure TForm1.Timer1Timer(Sender: TObject);
var
WinHandle: HWND;
ProcessID: DWORD;
ProcessHandle: THandle;
S: String;
Bytes: DWORD;
begin
WinHandle := FindWindow(nil, 'XXX');
if WinHandle = 0 then Exit;
GetWindowThreadProcessId(WinHandle, ProcessID);
if ProcessID = 0 then Exit;
ProcessHandle := OpenProcess(PROCESS_ALL_ACCESS, False, ProcessID);
if ProcessHandle = 0 then Exit;
try
SetLength(S, 10);
if ReadProcessMemory(ProcessHandle, Pointer($XXXXXX), PChar(S), 10, Bytes) then //注:内存地址正确,我用其它软件试过
///////////////////////////////////
listbox1.items.Add(s);
///////////////////////////////////
finally
CloseHandle(ProcessHandle);
end;
end;
以上的S添加到ListBox1中可以显示字符
为什么ADD到TStringList中再SaveToFile就没的呢?