msw-hotkey

Crates.iomsw-hotkey
lib.rsmsw-hotkey
version0.2.1
sourcesrc
created_at2022-05-06 00:48:58.499706
updated_at2022-05-07 14:39:58.196618
descriptionA hotkey library for Microsoft Windows
homepage
repositoryhttps://github.com/DaSeinUndZeit/msw-hotkey
max_upload_size
id581379
size18,025
xzy (LucaXiang)

documentation

https://docs.rs/msw-hotkey

README

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);
  }

}
Commit count: 10

cargo fmt