• Use [hide] Content [/hide] to prevent leeching of your content.

Small Key Toggle Macro

(+)

Member
C++:
#include <windows.h>

#define KeyState( Key , state , btoggle ) \
if(!GetAsyncKeyState( Key ) ) { btoggle = false; } \
else { if( !btoggle ) { state = !state; btoggle = true; } }


Use it this way .

bool xqz = false;
bool xhair = false;
bool Toggle[2] = {false};


KeyState( VK_F12 , xqz , Toggle[0])

KeyState( VK_F11 , xhair , Toggle[1])

Explanation:

Whenever VK_F12 (F12) / VK_F11 (F11) is pressed , xqx/xhair will toggle between true and false . 8)
This Macro only uses one GetAsyncKeystate . Others forced to use at least two . Using &1 results in hotkey spam .
 
Last edited by a moderator:
Top Bottom