Results 1 to 8 of 8
  1. #1
    nbr1dan's Avatar
    Join Date
    Mar 2007
    Location
    At my computer
    Posts
    168
    Reputation
    14
    Thanks
    15

    How can i add hotkeys in Visual c++

    Hello, my question is how can I add hotkeys to my c++ warrock trainer?

    Any info is much appreciated

  2. #2
    cjg333's Avatar
    Join Date
    Apr 2007
    Location
    indianapolis
    Posts
    300
    Reputation
    17
    Thanks
    54
    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.

  3. #3
    d.vel.oper's Avatar
    Join Date
    Oct 2007
    Gender
    male
    Location
    d3d8.dll->Direct3DCreate8
    Posts
    133
    Reputation
    12
    Thanks
    13
    Here's a quick example, commented and such.

    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;
    }
    Quick tip, don't think of programming in C++ as you would with Visual Basic. They are far from the same thing.

  4. #4
    d.vel.oper's Avatar
    Join Date
    Oct 2007
    Gender
    male
    Location
    d3d8.dll->Direct3DCreate8
    Posts
    133
    Reputation
    12
    Thanks
    13
    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;
    }

  5. #5
    Threadstarter
    Advanced Member
    nbr1dan's Avatar
    Join Date
    Mar 2007
    Location
    At my computer
    Posts
    168
    Reputation
    14
    Thanks
    15
    Thanks for this info! just what I was looking for.

  6. #6
    d.vel.oper's Avatar
    Join Date
    Oct 2007
    Gender
    male
    Location
    d3d8.dll->Direct3DCreate8
    Posts
    133
    Reputation
    12
    Thanks
    13
    No problem. If you get stuck or have questions, etc, feel free to reply in this thread.

  7. #7
    Vinniejboy's Avatar
    Join Date
    Oct 2007
    Posts
    1
    Reputation
    10
    Thanks
    0
    Where do i have to put the code any of u gave?
    Im new at the hacking thing so please sumone can reply?

  8. #8
    pbsucks's Avatar
    Join Date
    Sep 2007
    Location
    univers
    Posts
    65
    Reputation
    10
    Thanks
    4
    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

Similar Threads

  1. how can add farfog in my hack??
    By spartacchio in forum C++/C Programming
    Replies: 9
    Last Post: 04-23-2008, 02:30 PM
  2. How do i add hotkeys to my hack (VB6) ??
    By floris12345! in forum Visual Basic Programming
    Replies: 1
    Last Post: 01-04-2008, 05:29 AM
  3. How can i resize a pic?
    By darkone1149 in forum Art & Graphic Design
    Replies: 4
    Last Post: 02-08-2006, 05:31 PM
  4. how can i make game hack?!!!!
    By UnknownID in forum General Game Hacking
    Replies: 2
    Last Post: 02-07-2006, 07:21 PM
  5. how do you add fonts in PS
    By darkone1149 in forum Art & Graphic Design
    Replies: 2
    Last Post: 02-06-2006, 05:32 PM