Setting Cursor Position According To KeyState [Solved]
Talk about over-posting, right? This is pretty much the only forum I go on >_<
Anyways, I'm curious why this doesn't work:
Code:
#include "stdafx.h"
#include <Windows.h>
#include <iostream>
#include <WinUser.h>
#include <string.h>
using namespace std;
int main()
{
if(GetAsyncKeyState(VK_LMENU))
{
POINT cursorPos;
GetCursorPos(&cursorPos);
float x = 0;
x = cursorPos.x;
float y = 0;
y = cursorPos.y;
char msg[50];
SetCursorPos(x, y);
}
main();
}
Kind of obvious what it should do. If it gets Left Alt down, it sets the cursor to the spot where the cursor was...But I need it to not move the cursor while ALT is held down, and allow free movement once ALT is up. I guess I don't get the full understanding of GetAsyncKeyState()
