rusty-duplication
Capture the screen on Windows using the Desktop Duplication API in Rust, with shared memory support.
Installation
Usage
use ;
use ;
Advanced Usage
Shared Memory
You can use shared memory to share the buffer between processes.
This lib provides a SharedCapturer which will use Windows shared memory to store the buffer. Just call DuplicateContext.shared_capturer with a name.
manager.contexts.shared_capturer.unwrap;
Note: if your memory name starts with
Global\\, you may need to run this in administrator mode. See the doc.
Customized Capturer
This lib provides low-level APIs like DuplicateContext, so you can write your own capturer. You can refer to SimpleCapturer's implementation.
Test
Run the tests using cargo test -- --test-threads=1 to prevent the tests from running in parallel.
Note: move your mouse during the test to make sure the mouse pointer is captured, also make sure your mouse is in the primary monitor.
Credit
This project is based on the following projects:
- https://github.com/bryal/dxgcap-rs
- https://github.com/microsoft/windows-rs
- https://github.com/hecomi/uDesktopDuplication