From 92d3907ec7a856f9b843b929aaa0e3e07be52744 Mon Sep 17 00:00:00 2001 From: Helios Agent Date: Tue, 3 Mar 2026 16:44:46 +0100 Subject: [PATCH] fix(client): PrintWindow in Gdi not WindowsAndMessaging, clean up unused imports --- crates/client/src/screenshot.rs | 13 ++++++------- crates/client/src/windows_mgmt.rs | 3 +-- 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/crates/client/src/screenshot.rs b/crates/client/src/screenshot.rs index 6edd20d..3ea8063 100644 --- a/crates/client/src/screenshot.rs +++ b/crates/client/src/screenshot.rs @@ -3,10 +3,10 @@ use base64::Engine; #[cfg(windows)] pub fn take_screenshot() -> Result<(String, u32, u32), String> { - use windows::Win32::Foundation::RECT; + use windows::Win32::Graphics::Gdi::{ BitBlt, CreateCompatibleBitmap, CreateCompatibleDC, DeleteDC, DeleteObject, - GetDIBits, GetObjectW, SelectObject, BITMAP, BITMAPINFO, BITMAPINFOHEADER, + GetDIBits, SelectObject, BITMAPINFO, BITMAPINFOHEADER, DIB_RGB_COLORS, SRCCOPY, }; use windows::Win32::UI::WindowsAndMessaging::GetDesktopWindow; @@ -120,14 +120,13 @@ pub fn take_screenshot() -> Result<(String, u32, u32), String> { /// Capture a specific window using PrintWindow (works even if occluded). #[cfg(windows)] pub fn take_window_screenshot(window_id: u64) -> Result<(String, u32, u32), String> { - use windows::Win32::Foundation::{HWND, RECT}; + use windows::Win32::Foundation::HWND; use windows::Win32::Graphics::Gdi::{ CreateCompatibleBitmap, CreateCompatibleDC, DeleteDC, DeleteObject, - GetDIBits, SelectObject, BITMAPINFO, BITMAPINFOHEADER, DIB_RGB_COLORS, + GetDC, GetDIBits, PrintWindow, PW_RENDERFULLCONTENT, ReleaseDC, + SelectObject, BITMAPINFO, BITMAPINFOHEADER, DIB_RGB_COLORS, }; - use windows::Win32::UI::WindowsAndMessaging::{GetWindowRect, PrintWindow, PW_RENDERFULLCONTENT}; - use windows::Win32::Graphics::Gdi::GetDC; - use windows::Win32::Graphics::Gdi::ReleaseDC; + use windows::Win32::UI::WindowsAndMessaging::GetWindowRect; let hwnd = HWND(window_id as isize); diff --git a/crates/client/src/windows_mgmt.rs b/crates/client/src/windows_mgmt.rs index b3d6298..d286f79 100644 --- a/crates/client/src/windows_mgmt.rs +++ b/crates/client/src/windows_mgmt.rs @@ -5,11 +5,10 @@ use helios_common::protocol::WindowInfo; #[cfg(windows)] mod win_impl { use super::*; - use std::sync::Mutex; use windows::Win32::Foundation::{BOOL, HWND, LPARAM}; use windows::Win32::UI::WindowsAndMessaging::{ BringWindowToTop, EnumWindows, GetWindowTextW, IsWindowVisible, SetForegroundWindow, - ShowWindow, SW_MAXIMIZE, SW_MINIMIZE, SW_RESTORE, SHOW_WINDOW_CMD, + ShowWindow, SW_MAXIMIZE, SW_RESTORE, }; use windows::Win32::UI::Input::KeyboardAndMouse::{ keybd_event, KEYEVENTF_KEYUP, VK_MENU,