9 releases (breaking)
0.7.0 | Jan 18, 2023 |
---|---|
0.6.0 | Dec 9, 2022 |
0.5.0 | Jul 19, 2022 |
0.4.0 | Jun 25, 2022 |
0.1.0 | Mar 3, 2022 |
#46 in Windows APIs
72 downloads per month
Used in battery-savior
59KB
886 lines
wineventhook
A rusty wrapper over SetWinEventHook and UnhookWinEvent.
Example
This example shows how to listen for all window events and print them to the console.
use wineventhook::{EventFilter, WindowEventHook};
#[tokio::main]
async fn main() {
// Create a new hook
let (event_tx, mut event_rx) = tokio::sync::mpsc::unbounded_channel();
let hook = WindowEventHook::hook(
EventFilter::default(),
event_tx,
).await.unwrap();
// Wait and print events
while let Some(event) = event_rx.recv().await {
println!("{:#?}", event);
}
// Unhook the hook
hook.unhook().await.unwrap();
}
License
Licensed under MIT license (LICENSE or http://opensource.org/licenses/MIT)
Dependencies
~2.6–7MB
~112K SLoC