Heres my code:
Code:
if ( GetAsyncKeyState ( VK_LBUTTON ) )
{
for ( int i = 0; i < 3; i++ )
{
Sleep ( 30 );
if ( macro.mouseMacro == 1 )
{
left_click(); //function i created to simulate left click
}
else
{
sk.SendKeys(macro.keyboardMacro.c_str());
} // end else
} // end for
} // end if
For some reason, when I click once, it goes in an infinite loop and keeps simulating a left click, when its actually only supposed to do it only 3 times.
Left Click Function
Code:
int left_click()
{
// left mouse button down
INPUT Input={0};
Input.type = INPUT_MOUSE;
Input.mi.dwFlags = MOUSEEVENTF_LEFTDOWN;
::SendInput(1,&Input,sizeof(INPUT));
// left mouse button up
::ZeroMemory(&Input,sizeof(INPUT));
Input.type = INPUT_MOUSE;
Input.mi.dwFlags = MOUSEEVENTF_LEFTUP;
::SendInput(1,&Input,sizeof(INPUT));
}
any help will be appreciated.
thanks,
guitarist809