I not remember correct offset, try 02B977B8 or 02B977B0, is not matter, how did u read Troy.exe enter point?
For pressing key try to use sendkey.pas (w_w_w.tt.rim.or.jp/~muramatu/delphi/SendKey/SENDKEY.PAS (for Delphi..)
some code:
Code:
GetWindowThreadProcessId(HandleWindow ,{at}ProcessId);
ProcHandle := OpenProcess(PROCESS_QUERY_INFORMATION or PROCESS_VM_READ or PROCESS_VM_OPERATION,False,ProcessId);
GameEntryPoint :=GetModuleBase(ProcessId, 'TROY.EXE');
outbytes := sizeof(Dword);
with TroyPlayer do
begin
// Stats
PlayerHP.Offset := $02B977B0; //may be is not correct offset
PlayerHP.ValueName := 'HP: ';
ReadProcessMemory(ProcHandle, Pointer(GameEntryPoint+PlayerHP.Offset), {at}PlayerHP.ValueInt, sizeof(PlayerHP.ValueInt), outbytes);
-----
GameEntryPoint return 0, wtf?