C++ TRAINER

Posts 1–5 of 5 · Page 1 of 1
C++ TRAINER
Hi, I have a question for you want to create a trainer in C++, I have a request. . . edit someone fashion me this code?


Code:
#include <iostream>

#include <windows.h>

using namespace std;



int main()

{

    int newValue = 40;



    HWND hWnd = FindWindow(0, "Saper");



    if (hWnd == 0) {

        cerr << "Nie ma okna" << endl;

    } else {

        DWORD pId;

        GetWindowThreadProcessId(hWnd, &pId);

        HANDLE hProc = OpenProcess(PROCESS_ALL_ACCESS, FALSE, pId);



        if (!hProc) {

            cerr << "Nie widac procesu" << endl;

        } else {

            int isSuccessful = WriteProcessMemory(hProc, (LPVOID)0x0024909C, &newValue, (DWORD)sizeof(newValue), NULL);



            if (isSuccessful > 0) {

                clog << "Proces zostal dobrze zaladowany!" << endl;

            } else {

                cerr << "Nie mozna zapisac w pamieci procesu." << endl;

            }



            CloseHandle(hProc);

        }

    }



    return 0;

}
How can I make the function key? And how do I remove that, as the fires of my program is that the CLI does not appear the words ' instance with returned 0 excution time: . . . . the s and how do I add the offset to that address because every now and then I need to change the addresses and I want it to be fixed
Code:
bool s = false;
while( !( GetAsyncKeyState( 'x' ) & 0x8000 ) ) // While the user doesn't have the X key held down
{
       if( GetAsyncKeyState( VK_F1 ) & 1 ) // If the user pressed "F1"
       {
             s = s == false; // Little trick for toggling booleans
             if( s )
                DoEnabled();
             else
                DoDisabled();
       }

       Sleep( 100 ); // Don't spam the CPU
}
Quote Originally Posted by Hitokiri~ View Post
Code:
bool s = false;
while( !( GetAsyncKeyState( 'x' ) & 0x8000 ) ) // While the user doesn't have the X key held down
{
       if( GetAsyncKeyState( VK_F1 ) & 1 ) // If the user pressed "F1"
       {
             s = s == false; // Little trick for toggling booleans
             if( s )
                DoEnabled();
             else
                DoDisabled();
       }

       Sleep( 100 ); // Don't spam the CPU
}
Why not toggle it like this:
Code:
s = !s;
Quote Originally Posted by Harava View Post
Why not toggle it like this:
Code:
s = !s;
Works either way. Just shorter typing.
Posts 1–5 of 5 · Page 1 of 1

Post a Reply

Similar Threads

Tags for this Thread

None

Talk with us