Expand description
Windows API utilities for coordinate conversion, bit operations, and message parameter handling.
This crate provides utilities for working with Windows API concepts including:
- Coordinate conversion between client and screen coordinates
- Bit manipulation (LOWORD, HIWORD, LOBYTE, HIBYTE)
- Windows message parameter handling (WPARAM, LPARAM)
§Features
- Coordinate Conversion: ClientToScreen, ScreenToClient functionality
- Bit Manipulation: Extract high/low words and bytes from integers
- Message Parameters: Type-safe WPARAM and LPARAM handling
- Cross-platform: Works on Windows, Linux, and macOS
- No-std support: Core functionality available without std
- Feature Gating: Enable only the functionality you need
- Serialization: Optional serde support for message types
§Feature Flags
coordinates: Enables coordinate conversion types and traitsbit-ops: Enables bit manipulation utilitiesmessages: Enables Windows message handlingserde: Enables serialization support for typesfull: Enables all featuresminimal: Disables all optional features (default: enabled)
§Quick Start
§Using default features (coordinates + messages)
[dependencies]
windows-api-utils = "0.1"use windows_api_utils::prelude::*;
// Coordinate conversion
let window = Window::new(12345, Rect::new(100, 100, 500, 400), Default::default());
let client_point = Point::new(50, 30);
let screen_point = window.client_to_screen(client_point).unwrap();
// Message handling
let message = WindowMessage::mouse_move(100, 200, KeyModifiers::default());
if let Some(mouse_event) = MessageParser::parse_mouse_message(message) {
println!("Mouse at ({}, {})", mouse_event.x, mouse_event.y);
}§Using only coordinate features
[dependencies]
windows-api-utils = { version = "0.1", default-features = false, features = ["coordinates"] }use windows_api_utils::{Point, Rect, Window, CoordinateTransformer};
let window = Window::new(12345, Rect::new(100, 100, 500, 400), Default::default());
let client_point = Point::new(50, 30);
let screen_point = window.client_to_screen(client_point).unwrap();§Using only bit operations
[dependencies]
windows-api-utils = { version = "0.1", default-features = false, features = ["bit-ops"] }use windows_api_utils::{loword, hiword, make_long, BitUtils};
let value = 0x12345678;
let low = loword(value); // 0x5678
let high = hiword(value); // 0x1234
let reconstructed = make_long(high, low);§Minimal usage (no-std compatible)
[dependencies]
windows-api-utils = { version = "0.1", default-features = false }use windows_api_utils::WindowsUtilsError;
// Only error types available in minimal modeRe-exports§
pub use error::*;pub use coordinates::*;pub use messages::*;
Modules§
- coordinates
- Coordinate conversion utilities.
- error
- Error types for Windows API utilities.
- messages
- Windows message parameter handling.
- prelude
- Prelude for convenient imports based on enabled features.