Add simulated hotkeys

This commit is contained in:
2026-03-24 23:16:57 +01:00
parent f2af0c83c8
commit b02409a9cd
2 changed files with 41 additions and 0 deletions

View File

@@ -42,3 +42,16 @@ void RegisterHotkey(int vk, Modifier mods, std::function<void()> callback);
*/
void ProcessHotkeys(reshade::api::effect_runtime* runtime);
/**
* @brief Simulate Alt + Enter shortcut
*
* This function should be calld on event `on_present`
*/
void SimulateAltEnter();
/**
* @brief Simulate Alt + Tab shortcut
*
* This function should be calld on event `on_present`
*/
void SimulateAltTab();

View File

@@ -30,3 +30,31 @@ void ProcessHotkeys(reshade::api::effect_runtime* runtime) {
hotkey.wasPressed = pressed;
}
}
void SimulateAltEnter() {
INPUT inputs[4] = {};
// ALT down
inputs[0].type = INPUT_KEYBOARD;
inputs[0].ki.wVk = VK_MENU;
// ENTER down
inputs[1].type = INPUT_KEYBOARD;
inputs[1].ki.wVk = VK_RETURN;
// ENTER up
inputs[2].type = INPUT_KEYBOARD;
inputs[2].ki.wVk = VK_RETURN;
inputs[2].ki.dwFlags = KEYEVENTF_KEYUP;
// ALT up
inputs[3].type = INPUT_KEYBOARD;
inputs[3].ki.wVk = VK_MENU;
inputs[3].ki.dwFlags = KEYEVENTF_KEYUP;
SendInput(4, inputs, sizeof(INPUT));
}
void SimulateAltTab() {
keybd_event(VK_MENU, 0, 0, 0); // Appuyer sur Alt
keybd_event(VK_TAB, 0, 0, 0); // Appuyer sur Tab
keybd_event(VK_TAB, 0, KEYEVENTF_KEYUP, 0); // Relâcher Tab
keybd_event(VK_MENU, 0, KEYEVENTF_KEYUP, 0); // Relâcher Alt
}