use windows::Win32::Foundation::HWND;
use windows::Win32::UI::WindowsAndMessaging::GetWindowRect;
pub struct WindowBounds {
pub left: i32,
pub top: i32,
pub right: i32,
pub bottom: i32,
}
pub fn window_bounds(hwnd: i64) -> anyhow::Result<WindowBounds> {
unsafe {
let hwnd = HWND(hwnd as *mut _);
let mut rect = std::mem::zeroed();
GetWindowRect(hwnd, &mut rect)?;
Ok(WindowBounds {
left: rect.left,
top: rect.top,
right: rect.right,
bottom: rect.bottom,
})
}
}