@ Krootushas Gesu i got the keypress to go though, i used:
memset(inp, 0, sizeof(INPUT));
inp.type = INPUT_KEYBOARD;
inp.ki.dwFlags = KEYEVENTF_SCANCODE;
inp = inp;
inp.ki.dwFlags |= KEYEVENTF_KEYUP; // keyup event
inp.ki.wScan = inp.ki.wScan = DIK_Z; // inp = keydown, inp = keyup
SendInput(2, inp, sizeof(INPUT));
But now i am having a problem with the code 299 again, i have a bit more information now.
I think the only reason why i was able to read the memory address was because i created a pointer in cheat engine, i then ran my code and i was able to read it. But once i closed my directx application and started it back up i could not read from the memory address until i created another pointer in cheat engine. So i tired this bit of code to see if i could read it:
int NewCurrent = 0;
int *ptr = reinterpret_cast<int*>(0x744A4740) + Offset;
ReadProcessMemory(hProc, (LPCVOID)ptr, &NewCurrent, 4, NULL);
cout << "The new current is " << NewCurrent << endl;
But nothing, and i even rearranged it many times moving the variables and redefining the pointer but nothing seems to be working.