use rusty_duplication::{CapturerBuffer, FrameInfoExt, Scanner, SharedMemoryCapturer};
use std::{fs::File, io::Write, thread, time::Duration};
fn main() {
let monitor = Scanner::new().unwrap().next().unwrap();
let mut capturer = SharedMemoryCapturer::create(monitor, "SharedMemoryName").unwrap();
thread::sleep(Duration::from_millis(50));
let info = capturer.capture().unwrap();
assert!(info.desktop_updated());
let mut file = File::create("capture.bin").unwrap();
file.write_all(capturer.buffer.as_bytes()).unwrap();
}