1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
|
void CALLBACK TimerProc(HWND hWnd, UINT nMsg, UINT nIDEvent, DWORD dwTime)
{
mouse_event(MOUSEEVENTF_LEFTDOWN, xPos, yPos, 0, 0);
mouse_event(MOUSEEVENTF_LEFTUP, xPos, yPos, 0, 0);
}
void press()
{
qDebug() << "press work";
static bool rLMB = false; // Note: static
if(GetAsyncKeyState(0x52) && GetAsyncKeyState(0x01))
{
qDebug() << "if(GetAsyncKeyState(0x52) && GetAsyncKeyState(0x01))";
if(!rLMB)
{
qDebug() << "if(not rLMB)";
SetTimer(NULL, 1, 3000, &TimerProc); // This SetTimer dont start Timer.
}
}
if(GetAsyncKeyState(0x01) == 0)
{
qDebug() << "if(GetAsyncKeyState(0x01) == 0)";
if(rLMB)
{
qDebug() << "if(rLMB)";
rLMB = false;
KillTimer(NULL, 1);
}
}
}
|