procedure TForm1.Button1Click(Sender: TObject); var gameHwnd:Hwnd; pid: dword; h: THandle; lpNumberOfBytes: DWord; buf:DWord; buf2:Pointer; Buffer : Array[0..3] Of DWord; addr:DWORD; nSize: DWORD; s:WideString; i:Integer; begin gameHwnd:=FindWindow(nil,'Element Client'); if gameHwnd<>0 then begin GetWindowThreadProcessId(gameHwnd, @pid); h:=OpenProcess(PROCESS_ALL_ACCESS, false, pid); if h<>0 then begin addr:=$010EA0CC; edit2.Text:=Inttostr(gameHwnd); edit3.Text:=Inttostr(h); nSize:=4; ReadProcessMemory(h,Pointer(addr+$2A4),@buf,nSize,lpNumberOfBytes); s:=inttoStr(buf); edit1.Text:=s; showmessage(s); end; closeHandle(h); end else begin showmessage('游戏未运行!'); end; end;
d9的 var pD3D: IDirect3D9; g_pD3DDevice: IDirect3DDevice9; D3DPP: TD3DPresentParameters; begin pD3D := Direct3DCreate9(D3D_SDK_VERSION); ZeroMemory(@d3dpp,SizeOf(d3dpp)); D3DPP.BackBufferFormat:=D3DFMT_X8R8G8B8; D3DPP.Windowed:=True; D3DPP.SwapEffect:=D3DSWAPEFFECT_DISCARD; pD3D.CreateDevice(D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, GetDesktopWindow, D3DCREATE_SOFTWARE_VERTEXPROCESSING, @D3DPP, g_pD3DDevice); Edit1.Text:=IntToStr(g_pD3DDevice.GetAvailableTextureMem ); end
var gameHwnd:Hwnd;
pid: dword;
h: THandle;
lpNumberOfBytes: DWord;
buf:DWord;
buf2:Pointer;
Buffer : Array[0..3] Of DWord;
addr:DWORD;
nSize: DWORD;
s:WideString;
i:Integer;
begin
gameHwnd:=FindWindow(nil,'Element Client');
if gameHwnd<>0 then
begin
GetWindowThreadProcessId(gameHwnd, @pid);
h:=OpenProcess(PROCESS_ALL_ACCESS, false, pid);
if h<>0 then
begin
addr:=$010EA0CC;
edit2.Text:=Inttostr(gameHwnd);
edit3.Text:=Inttostr(h);
nSize:=4;
ReadProcessMemory(h,Pointer(addr+$2A4),@buf,nSize,lpNumberOfBytes);
s:=inttoStr(buf);
edit1.Text:=s;
showmessage(s);
end;
closeHandle(h);
end else begin
showmessage('游戏未运行!');
end;
end;
var
pD3D: IDirect3D9;
g_pD3DDevice: IDirect3DDevice9;
D3DPP: TD3DPresentParameters;
begin
pD3D := Direct3DCreate9(D3D_SDK_VERSION);
ZeroMemory(@d3dpp,SizeOf(d3dpp));
D3DPP.BackBufferFormat:=D3DFMT_X8R8G8B8;
D3DPP.Windowed:=True;
D3DPP.SwapEffect:=D3DSWAPEFFECT_DISCARD;
pD3D.CreateDevice(D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, GetDesktopWindow,
D3DCREATE_SOFTWARE_VERTEXPROCESSING, @D3DPP, g_pD3DDevice);
Edit1.Text:=IntToStr(g_pD3DDevice.GetAvailableTextureMem );
end
确实是得到总共显存大小的 得到的