HotKey pressing from another application

This forum is about all development around libVLC.
Nikxp
New Cone
New Cone
Posts: 1
Joined: 15 Jan 2019 14:42

HotKey pressing from another application

Postby Nikxp » 15 Jan 2019 15:13

I want to emulate hotkey's click from my application. There are 2 problems.
1) if i changed Windows system language (on Russian for example) hotKeys doesn't work at all.
2) To solve 1) problem i use SendInput function (https://docs.microsoft.com/en-us/window ... -sendinput) with wScan field with KEYEVENTF_UNICODE flag. But when i use code below strange thing are happend: when i clicked "f" VLC fullscreened, but after this on "m" click it doesn't Mute, but cancel fullscreen mode. If i started by "m" hotkey, then all other clicks will Mute/Unmute VLC.

How can i use fullscreen/ Mute and other functions from my app, when systemLanguage is Russian?

Code: Select all

void WindowsKeyClickEmulator::_clickKey(WORD key) { _pressKey(key); _releaseKey(key); } int oddIndex = 0; void WindowsKeyClickEmulator::_pressKey(WORD key) { QChar symbol; if( ++oddIndex % 2) { symbol = 'f'; } else { symbol = 'm'; } INPUT ip; ip.type = INPUT_KEYBOARD; ip.ki.wScan = symbol.unicode(); ip.ki.time = 0; ip.ki.wVk = 0; ip.ki.dwFlags = KEYEVENTF_UNICODE; ip.ki.dwExtraInfo = 0; SendInput(1, &ip, sizeof(INPUT)); } void WindowsKeyClickEmulator::_releaseKey(WORD key) { QChar symbol; if( oddIndex % 2) { symbol = 'f'; } else { symbol = 'm'; } INPUT ip; ip.type = INPUT_KEYBOARD; ip.ki.wScan = symbol.unicode(); ip.ki.time = 0; ip.ki.wVk = 0; ip.ki.dwFlags = KEYEVENTF_UNICODE + KEYEVENTF_KEYUP; ip.ki.dwExtraInfo = 0; SendInput(1, &ip, sizeof(INPUT)); }

Return to “Development around libVLC”

Who is online

Users browsing this forum: No registered users and 10 guests