#include
#include
#include
#ifdef __MINGW32__
#include
#endif
using namespace std;
int main(){
DWORD Target = 0x22ACBA164D0;
SIZE_T bytes = 0;
BYTE exampleBytes[5] = { 0x8B,0xFF,0x55,0x8B,0xEC };
HWND hWnd;
while( !( hWnd = FindWindow( NULL, "Calculatrice" ) ) )
Sleep( 100 );
DWORD PID;
while( !( GetWindowThreadProcessId( hWnd, &PID ) ) )
Sleep( 100 );
// as learn_more said, you need process handle.
HANDLE hProcess;
while( !( hProcess = OpenProcess( PROCESS_VM_OPERATION | PROCESS_VM_READ | PROCESS_VM_WRITE, 0, PID ) ) )
Sleep( 100 );
WriteProcessMemory( hProcess, (PVOID)Target, exampleBytes, 5, &bytes );
system("pause");
return 0;
}