JFLib

plat/win_hotkey.rs (Windows)#

Source: lib/plat/win_hotkey.rs

win_hotkey -- (hotkey.rs) global shortcuts on Windows: RegisterHotKey on a message-only window
of the UI thread

  available() -> true          register(id, chord, _) / unregister(id)
  (test aids) hotkey_test_post(id) posts WM_HOTKEY of a registered id to the window (the path
  of the window procedure without a key); hotkey_test_input(vk) presses and releases vk with
  SendInput (the real way through the system: only for keys nobody uses, F13-F24)

The app's ids map to the window's hotkey ids 1..0xBFFF (the range RegisterHotKey allows
applications).  MOD_NOREPEAT: a held chord reports once.  ERROR_HOTKEY_ALREADY_REGISTERED
(another program or thread holds the chord) is Conflict.  WM_HOTKEY -> hotkey::push(Pressed).
  • fn hotkey_test_post(id: u32) -> bool (test aid) WM_HOTKEY of the registered id posted to the window -> false when unknown

  • fn hotkey_test_input(vk: u32) -> u32 (test aid) press and release vk through SendInput (only F13-F24: keys no program uses) -> the events the system took (2 = both)

Source: docs/API.md in the JFLib repository.