Skip to content

A rusty wrapper over SetWinEventHook and UnhookWinEvent.

License

Notifications You must be signed in to change notification settings

OpenByteDev/wineventhook-rs

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

42 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

wineventhook

CI crates.io Documentation dependency status MIT

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)

About

A rusty wrapper over SetWinEventHook and UnhookWinEvent.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages