https://github.com/openbytedev/wineventhook-rs
A rusty wrapper over SetWinEventHook and UnhookWinEvent.
https://github.com/openbytedev/wineventhook-rs
Last synced: about 1 year ago
JSON representation
A rusty wrapper over SetWinEventHook and UnhookWinEvent.
- Host: GitHub
- URL: https://github.com/openbytedev/wineventhook-rs
- Owner: OpenByteDev
- License: mit
- Created: 2022-03-03T02:25:50.000Z (about 4 years ago)
- Default Branch: master
- Last Pushed: 2024-02-06T22:25:26.000Z (about 2 years ago)
- Last Synced: 2025-04-14T03:02:51.453Z (about 1 year ago)
- Language: Rust
- Size: 73.2 KB
- Stars: 11
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# wineventhook
[](https://github.com/OpenByteDev/wineventhook-rs/actions/workflows/ci.yml)
[](https://crates.io/crates/wineventhook)
[](https://docs.rs/wineventhook)
[](https://deps.rs/repo/github/openbytedev/wineventhook-rs)
[](https://github.com/OpenByteDev/wineventhook-rs/blob/master/LICENSE)
A rusty wrapper over SetWinEventHook and UnhookWinEvent.
# Example
This example shows how to listen for all window events and print them to the console.
```rust
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](https://github.com/OpenByteDev/wineventhook-rs/blob/master/LICENSE) or http://opensource.org/licenses/MIT)