you have to make some timers for your hotkeys,like a vb6 app.i have a tut on my site witch i cant link you too cause this sites gay.
Hello, my question is how can I add hotkeys to my c++ warrock trainer?
Any info is much appreciated
you have to make some timers for your hotkeys,like a vb6 app.i have a tut on my site witch i cant link you too cause this sites gay.
Here's a quick example, commented and such.
Quick tip, don't think of programming in C++ as you would with Visual Basic. They are far from the same thing.Code:#include "stdafx.h" bool bOption1 = false; // Option #1 toggle bool bOption2 = false; // Option #2 toggle bool bOption3 = false; // Option #3 toggle bool bDone = false; // Quit toggle #define IsKeyDown(Key) GetAsyncKeyState(Key) & 0x8000 // Shortcut for checking if a key is down. DWORD WINAPI HotkeyThread(LPVOID lpParam) { while (!bDone) { if (IsKeyDown(VK_F1)) // If F1 is pressed... { bOption1 = !bOption1; // Toggle Option #1 } else if (IsKeyDown(VK_F2)) // If F2 is pressed... { bOption2 = !bOption2; // Toggle Option #2 } else if (IsKeyDown(VK_F3)) // If F3 is pressed... { bOption3 = !bOption3; // Toggle Option #3 } else if (IsKeyDown(VK_F4)) // If F4 is pressed... { bDone = !bDone; // Quit } Sleep(50); // Let the thread sleep for 50 milliseconds, saves a bit of CPU usage. } return 0; // Default thread exit code. } int main() { CreateThread(NULL, NULL, HotkeyThread, NULL, 0, NULL); // Start our hotkey thread while (!bDone) // Keep looking until quit key is pressed. { if (bOption1) { //TODO: Add option #1 } if (bOption2) { //TODO: Add option #2 } if (bOption3) { //TODO: Add option #3 } Sleep(50); // Sleep for 50 milliseconds, etc. } return 0; }
Simple example code, commented as best as I could make it off the top of my head.
Code:#include "stdafx.h" bool bOption1 = false; // Option #1 toggle bool bOption2 = false; // Option #2 toggle bool bOption3 = false; // Option #3 toggle bool bDone = false; // Quit toggle #define IsKeyDown(Key) GetAsyncKeyState(Key) & 0x8000 // Shortcut for checking if a key is down. DWORD WINAPI HotkeyThread(LPVOID lpParam) { while (!bDone) { if (IsKeyDown(VK_F1)) // If F1 is pressed... { bOption1 = !bOption1; // Toggle Option #1 } else if (IsKeyDown(VK_F2)) // If F2 is pressed... { bOption2 = !bOption2; // Toggle Option #2 } else if (IsKeyDown(VK_F3)) // If F3 is pressed... { bOption3 = !bOption3; // Toggle Option #3 } else if (IsKeyDown(VK_F4)) // If F4 is pressed... { bDone = !bDone; // Quit } Sleep(50); // Let the thread sleep for 50 milliseconds, saves a bit of CPU usage. } return 0; // Default thread exit code. } int main() { CreateThread(NULL, NULL, HotkeyThread, NULL, 0, NULL); // Start our hotkey thread while (!bDone) // Keep looking until quit key is pressed. { if (bOption1) { //TODO: Add option #1 } if (bOption2) { //TODO: Add option #2 } if (bOption3) { //TODO: Add option #3 } Sleep(50); // Sleep for 50 milliseconds, etc. } return 0; }
Thanks for this info! just what I was looking for.
No problem. If you get stuck or have questions, etc, feel free to reply in this thread.
Where do i have to put the code any of u gave?
Im new at the hacking thing so please sumone can reply?
my c++ version is so strange...
although i have to modify all your GREAT TUTORIALS FOR C++, i'm quite happy with it, cause it is a bit easier to understand and has more features...
for example the whole keypress suite is already there, so i don't need to define it, just to check