Fix Windows crate 0.58 API compatibility

- Define XBUTTON1/XBUTTON2 constants (removed from windows crate)
- Update D3D11_CPU_ACCESS_FLAG usage
- Fix CreateTexture2D output parameter
- Fix BitBlt/EnumDisplayMonitors return type handling
- Fix encode_utf16 iterator usage
This commit is contained in:
AZ Computer Guru
2025-12-28 12:39:33 -07:00
parent 33893ea73b
commit 09223cf97a
5 changed files with 29 additions and 17 deletions

View File

@@ -4,7 +4,7 @@
//! Slower than DXGI but works on older systems and edge cases.
use super::{CapturedFrame, Capturer, Display};
use anyhow::{Context, Result};
use anyhow::Result;
use std::time::Instant;
use windows::Win32::Graphics::Gdi::{
@@ -58,7 +58,7 @@ impl GdiCapturer {
let old_bitmap = SelectObject(mem_dc, bitmap);
// Copy screen to memory DC
let result = BitBlt(
if let Err(e) = BitBlt(
mem_dc,
0,
0,
@@ -68,14 +68,12 @@ impl GdiCapturer {
self.display.x,
self.display.y,
SRCCOPY,
);
if !result.as_bool() {
) {
SelectObject(mem_dc, old_bitmap);
DeleteObject(bitmap);
DeleteDC(mem_dc);
ReleaseDC(HWND::default(), screen_dc);
anyhow::bail!("BitBlt failed");
anyhow::bail!("BitBlt failed: {}", e);
}
// Prepare bitmap info for GetDIBits