wineventhook 0.11.0

A rusty wrapper over SetWinEventHook and UnhookWinEvent.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
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();
}