From 4ea5462ef6b91dee15b85d996dad43840d091490 Mon Sep 17 00:00:00 2001 From: enximi Date: Tue, 16 Apr 2024 17:11:33 +0800 Subject: [PATCH] Use isize instead of HWND --- src/window.rs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/window.rs b/src/window.rs index f56b3ab..fae9503 100644 --- a/src/window.rs +++ b/src/window.rs @@ -216,16 +216,16 @@ impl Window { /// /// # Arguments /// - /// * `window` - The raw HWND. + /// * `hwnd` - The hwnd. #[must_use] - pub const fn from_raw_hwnd(window: HWND) -> Self { - Self { window } + pub const fn from_raw_hwnd(hwnd: isize) -> Self { + Self { window: HWND(hwnd)} } /// Returns the raw HWND of the window. #[must_use] - pub const fn as_raw_hwnd(&self) -> HWND { - self.window + pub const fn as_raw_hwnd(&self) -> isize { + self.window.0 } // Callback used for enumerating all windows. @@ -245,7 +245,7 @@ impl TryFrom for GraphicsCaptureItem { type Error = Error; fn try_from(value: Window) -> Result { - let window = value.as_raw_hwnd(); + let window = HWND(value.as_raw_hwnd()); let interop = windows::core::factory::()?; Ok(unsafe { interop.CreateForWindow(window)? })