msw-hotkey 0.2.1

A hotkey library for Microsoft Windows
Documentation
  • Coverage
  • 1.47%
    1 out of 68 items documented1 out of 1 items with examples
  • Size
  • Source code size: 17.67 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 3.07 MB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 10s Average build duration of successful builds.
  • all releases: 10s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • LucaXiang/msw-hotkey
    1 0 0
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • LucaXiang

MSW-HOTKEY

A hotkey library for Microsoft Windows

How to use

use msw-hotkey::Hotkey
// https://github.com/microsoft/windows-rs
// https://microsoft.github.io/windows-docs-rs/doc/windows/Win32/UI/Input/KeyboardAndMouse/fn.RegisterHotKey.html
use windows::Win32::UI::Input::KeyboardAndMouse::RegisterHotKey
// https://microsoft.github.io/windows-docs-rs/doc/windows/Win32/UI/Input/KeyboardAndMouse/struct.HOT_KEY_MODIFIERS.html
use windows::Win32::UI::Input::KeyboardAndMouse::HOT_KEY_MODIFIERS;


fn main()
{
  let hotkey = Hotkey::from_str("ctrl + a");
  unsafe {
    RegisterHotkey(Win32::Foundation::HWND(0) , 1 ,HOT_KEY_MODIFIERS(hotkey.modifier()), hotkey.key() as u32);
  }

}