Cheat Engine Forum Index Cheat Engine
The Official Site of Cheat Engine
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


finding the handle to a process(C++)?

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming
View previous topic :: View next topic  
Author Message
oib111
I post too much
Reputation: 0

Joined: 02 Apr 2007
Posts: 2947
Location: you wanna know why?

PostPosted: Sat Sep 01, 2007 4:35 am    Post subject: finding the handle to a process(C++)? Reply with quote

I want to find the handle to a process so I can use ReadProcessMemory() on it. I'm pretty sure I can use OpenProcess() and FindWindow() and GetWindowThreadProcessId(). I just want to know if this is the right way to do it.

Code:

HWND hWnd;
DWORD pid;
HANDLE hProc;

hWnd = FindWindow(NULL,"Name of Window");
GetWindowThreadProcessId(hWnd,&pid);
hProc = OpenProcess(PROCESS_ALL_ACCESS|PROCESS_VM_READ,0,pid);

//start readprocessmemory here....


If this isn't the right way cna someone edit the code and post it?

_________________


8D wrote:

cigs dont make people high, which weed does, which causes them to do bad stuff. like killing
Back to top
View user's profile Send private message AIM Address Yahoo Messenger MSN Messenger
Noz3001
I'm a spammer
Reputation: 26

Joined: 29 May 2006
Posts: 6220
Location: /dev/null

PostPosted: Sat Sep 01, 2007 5:08 am    Post subject: Reply with quote

are you allowed to or something with PROCESS_ALL_ACCESS?
Back to top
View user's profile Send private message MSN Messenger
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group

CE Wiki   IRC (#CEF)   Twitter
Third party websites