Jump to content

Sky Slate Blueberry Blackcurrant Watermelon Strawberry Orange Banana Apple Emerald Chocolate

Trying to recreate rapid fire in c++

  • Please log in to reply
No replies to this topic
  • Members
  • 1 posts
  • Last active: Oct 29 2015 11:38 AM
  • Joined: 26 Oct 2015

So i'm fairly new to c++ and i can't really find what i'm looking for anywhere. I'm trying to create a rapid fire application of my own but what i can't figure out is how ahk is able to use check whether a button is down while also simulating clicks with the same button. So for instance i want to make the mouse click a bunch of times(rapid fire) but since im simulating the mouse being pressed down and up i can't check whether the mouse button is actually down. I know ahk is open source but i have no idea where to look and i would probably have to look through the entire thing to figure out how everything works. Can anyone who's looked through the source or anyone who's worked on ahk help me out ? Here is my code.

#include "stdafx.h"
#include <Windows.h>

int _tmain(int argc, _TCHAR* argv[])
	SHORT WINAPI GetKeyState(_In_ int vKey);

	while (true)
		if ((GetKeyState(0x01) & 0x8000) != 0)
			static INPUT Input = { 0 };

			Input.type = INPUT_MOUSE;
			Input.mi.dwFlags = MOUSEEVENTF_LEFTDOWN;
			::SendInput(1, &Input, sizeof(INPUT));

			::ZeroMemory(&Input, sizeof(INPUT));
			Input.type = INPUT_MOUSE;
			Input.mi.dwFlags = MOUSEEVENTF_LEFTUP;
			::SendInput(1, &Input, sizeof(INPUT));

	return 0;