W
Weeke
Guest
void SendCtrlKey()
{
// Simulate a key press
keybd_event(VK_CONTROL, 0x9d, 0, 0);
Sleep(350);
// Simulate a key release
keybd_event(VK_CONTROL, 0x9d, KEYEVENTF_KEYUP, 0);
Sleep(50);
}
private: System::Void FCW_checkBox_CheckedChanged(System::Object^ sender, System::EventArgs^ e)
{
if (FCW_checkBox->Checked)
{
FCR_timer->Start();
}
else
{
FCR_timer->Stop();
}
}
private: System::Void FCR_timer_Tick(System::Object^ sender, System::EventArgs^ e)
{
if (GetKeyState(XBUTTON1))
{
SendCtrlKey();
}
else
{
// Do Nothing if XBUTTON1 not held down
}
}
When i check the checkbox it doesnt check for XBUTTON1 and just continues to spam SendCtrlKey() Function until the checkbox is unchecked. I have tried adding delays and messing with the timer settings with no success. From i what i see i just cannot understand why it is doing that loop endlessly without the button being pressed.
Any help or suggestions would be greatly appreciated. Thanks.
Continue reading...
{
// Simulate a key press
keybd_event(VK_CONTROL, 0x9d, 0, 0);
Sleep(350);
// Simulate a key release
keybd_event(VK_CONTROL, 0x9d, KEYEVENTF_KEYUP, 0);
Sleep(50);
}
private: System::Void FCW_checkBox_CheckedChanged(System::Object^ sender, System::EventArgs^ e)
{
if (FCW_checkBox->Checked)
{
FCR_timer->Start();
}
else
{
FCR_timer->Stop();
}
}
private: System::Void FCR_timer_Tick(System::Object^ sender, System::EventArgs^ e)
{
if (GetKeyState(XBUTTON1))
{
SendCtrlKey();
}
else
{
// Do Nothing if XBUTTON1 not held down
}
}
When i check the checkbox it doesnt check for XBUTTON1 and just continues to spam SendCtrlKey() Function until the checkbox is unchecked. I have tried adding delays and messing with the timer settings with no success. From i what i see i just cannot understand why it is doing that loop endlessly without the button being pressed.
Any help or suggestions would be greatly appreciated. Thanks.
Continue reading...