Expand description
A rusty wrapper over the window event API specifically SetWinEventHook and UnhookWinEvent.
For the type of events that can be hooked, see WindowEvent.
§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();
}Modules§
- raw_
event - Module containing the raw event codes and ranges.
Structs§
- Event
Filter - A filter for window events to be received.
- RawWindow
Event - A raw window event received by a
WindowEventHook. - Window
Event - A window event received by a
WindowEventHook. - Window
Event Hook - A hook with a message loop that listens for window events.
Enums§
- Accessible
Object Id - The type of object associated with a window event.
- Console
Window Event - A known event indicating a change in a console window.
- Object
Window Event - A known event indicating a change in a console window.
- System
Window Event - A known event describing a situation affecting all applications in the system.
- Window
Event Type - The type of window event. See Event Constants, System-Level and Object-Level Events and Allocation of WinEvent IDs for more information.
Type Aliases§
- Event
Predicate - A filter for window events.
- Hook
Handle - A non null handle to a hook created using
SetWinEventHook. - RawHook
Handle - A raw handle to a hook created using
SetWinEventHook. - RawWindow
Handle - A raw handle to a window.
- Window
Handle - A non null handle to a window.