use windows_capture::dxgi_duplication_api::{DxgiDuplicationApi, DxgiDuplicationFormat};
use windows_capture::encoder::ImageFormat;
use windows_capture::monitor::Monitor;
fn main() -> Result<(), Box<dyn std::error::Error>> {
let monitor = Monitor::primary()?;
let mut dup = DxgiDuplicationApi::new_options(monitor, &[DxgiDuplicationFormat::Bgra8])?;
let mut frame = dup.acquire_next_frame(33)?;
frame.save_as_image("dxgi_screenshot.png", ImageFormat::Png)?;
Ok(())
}