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 


Making trainers with a programming language...?

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

Joined: 22 May 2007
Posts: 2221

PostPosted: Sat Sep 15, 2007 1:40 am    Post subject: Making trainers with a programming language...? Reply with quote

How can I make one with C++? I thought this stuff was all ASM...
Back to top
View user's profile Send private message Visit poster's website
hcavolsdsadgadsg
I'm a spammer
Reputation: 26

Joined: 11 Jun 2007
Posts: 5801

PostPosted: Sat Sep 15, 2007 1:46 am    Post subject: Reply with quote

Throw these into MSDN. Behold:

FindWindow
GetWindowThreadProcessId
OpenProcess

Write/ReadProcessMemory
Back to top
View user's profile Send private message
atom0s
Moderator
Reputation: 205

Joined: 25 Jan 2006
Posts: 8587
Location: 127.0.0.1

PostPosted: Sat Sep 15, 2007 2:37 pm    Post subject: Reply with quote

I suggest not using FindWindow to get the handle / procid of the process as it's outdated now adays as some games have the window name and/or the class name change constantly to avoid people from using that API to detect the window.

Instead you can use CreateToolhelp32Snapshot to get what you need.

An example in C++:

Code:

DWORD GetProcessId(char * szProcName)
{
   PROCESSENTRY32 pe32 = {0};
   HANDLE hSnapshot = 0;
   DWORD dwProcId = 0;

   if( Process32First( hSnapshot, &pe32 ) )
   {
      do{
         if( strcmp( szProcName, strlwr(pe32.szExeFile) ) == 0 )
         {
            dwProcId = pe32.th32ProcessID;
            break;
         }
      } while( Process32Next( hSnapshot, &pe32 ) );
   }

   if( hSnapshot != INVALID_HANDLE_VALUE )
      CloseHandle( hSnapshot );

   return dwProcId;
}
Back to top
View user's profile Send private message Visit poster's website
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