nashaofu / xcap

XCap is a cross-platform screen capture library written in Rust. It supports Linux (X11, Wayland), MacOS, and Windows. XCap supports screenshot and video recording (to be implemented).
https://docs.rs/xcap
Apache License 2.0
459 stars 55 forks source link

请问下Windows下可不可以获取进程id #127

Open hengkx opened 4 months ago

hengkx commented 4 months ago
unsafe {
                // 如果找到窗口句柄,则调用 GetWindowThreadProcessId 函数来获取进程 ID
                let mut process_id = 0;
                GetWindowThreadProcessId(window.id() as *mut HWND__, &mut process_id);
                println!("进程 ID: {}", process_id);
            }
hengkx commented 4 months ago

我看源代码里面有用这个‎GetWindowThreadProcessId有用这个函数可否加个进程Id属性

nashaofu commented 4 months ago

可以加

ponull commented 4 months ago

同求加进程id,我启动了多个窗口,截图时不知道是哪个进程启动的

nashaofu commented 3 months ago

https://github.com/nashaofu/xcap/pull/135 windows 已经支持了,其他平台还在开发