fix(client): PrintWindow in Gdi not WindowsAndMessaging, clean up unused imports
This commit is contained in:
parent
efc9cab2c3
commit
92d3907ec7
2 changed files with 7 additions and 9 deletions
|
|
@ -3,10 +3,10 @@ use base64::Engine;
|
||||||
|
|
||||||
#[cfg(windows)]
|
#[cfg(windows)]
|
||||||
pub fn take_screenshot() -> Result<(String, u32, u32), String> {
|
pub fn take_screenshot() -> Result<(String, u32, u32), String> {
|
||||||
use windows::Win32::Foundation::RECT;
|
|
||||||
use windows::Win32::Graphics::Gdi::{
|
use windows::Win32::Graphics::Gdi::{
|
||||||
BitBlt, CreateCompatibleBitmap, CreateCompatibleDC, DeleteDC, DeleteObject,
|
BitBlt, CreateCompatibleBitmap, CreateCompatibleDC, DeleteDC, DeleteObject,
|
||||||
GetDIBits, GetObjectW, SelectObject, BITMAP, BITMAPINFO, BITMAPINFOHEADER,
|
GetDIBits, SelectObject, BITMAPINFO, BITMAPINFOHEADER,
|
||||||
DIB_RGB_COLORS, SRCCOPY,
|
DIB_RGB_COLORS, SRCCOPY,
|
||||||
};
|
};
|
||||||
use windows::Win32::UI::WindowsAndMessaging::GetDesktopWindow;
|
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).
|
/// Capture a specific window using PrintWindow (works even if occluded).
|
||||||
#[cfg(windows)]
|
#[cfg(windows)]
|
||||||
pub fn take_window_screenshot(window_id: u64) -> Result<(String, u32, u32), String> {
|
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::{
|
use windows::Win32::Graphics::Gdi::{
|
||||||
CreateCompatibleBitmap, CreateCompatibleDC, DeleteDC, DeleteObject,
|
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::UI::WindowsAndMessaging::GetWindowRect;
|
||||||
use windows::Win32::Graphics::Gdi::GetDC;
|
|
||||||
use windows::Win32::Graphics::Gdi::ReleaseDC;
|
|
||||||
|
|
||||||
let hwnd = HWND(window_id as isize);
|
let hwnd = HWND(window_id as isize);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -5,11 +5,10 @@ use helios_common::protocol::WindowInfo;
|
||||||
#[cfg(windows)]
|
#[cfg(windows)]
|
||||||
mod win_impl {
|
mod win_impl {
|
||||||
use super::*;
|
use super::*;
|
||||||
use std::sync::Mutex;
|
|
||||||
use windows::Win32::Foundation::{BOOL, HWND, LPARAM};
|
use windows::Win32::Foundation::{BOOL, HWND, LPARAM};
|
||||||
use windows::Win32::UI::WindowsAndMessaging::{
|
use windows::Win32::UI::WindowsAndMessaging::{
|
||||||
BringWindowToTop, EnumWindows, GetWindowTextW, IsWindowVisible, SetForegroundWindow,
|
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::{
|
use windows::Win32::UI::Input::KeyboardAndMouse::{
|
||||||
keybd_event, KEYEVENTF_KEYUP, VK_MENU,
|
keybd_event, KEYEVENTF_KEYUP, VK_MENU,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue