-
Notifications
You must be signed in to change notification settings - Fork 5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
请问一下, wgc 如何一次把主屏副屏都截取? #2
Comments
桌面复制也只能一次截一屏 |
pBitmap指针确实是两块屏幕都有,不论用wincapture.WGC(0)或者wincapture.WGC(1)去截图,生成pBitmap指针后,整块屏幕(屏幕1和2)的截图都可以显示出来 |
不太可能,转换前后图像长宽变了? 有可能越界访问了,导致错误 |
我刚才试了一下,调用Gdip_CreateBitmapFromHBITMAP前,若我调用了Gdip_Startup() 若是忘记调用Gdip_Startup() 我用ImagePutWindow({ image: p_bm_buf, scale: 0.5 })进行显示。 这个可以100%复现 |
没有startup(),调用Gdip_CreateBitmapFromHBITMAP是没pbitmap的 |
真奇怪,我没startup(),结果就是显示整个屏幕。这跟系统和驱动有关系吗?我win11 23H2,nvidia的显卡和驱动 |
其实,一个月前,我也用过一次c++的 dxgi截屏,里面需要选择adapter,也是选择0或1,但没有选择全部屏幕截取下来,但是偶尔也会保存下载两个屏幕的一个超长截屏,但我没太注意,因为那时我只需要副屏。以后有时间再研究吧。 主要目的是两个屏幕数字在变化,一前一后截屏会有差异,不太好分析,所以希望一次截取整个屏幕,数据一致。现在改为先截取0,再直接截取1,看了看时间在1ms左右,应该可以用了。 |
是10ms左右 |
感觉截图都是调用桌面复制,所以,其实每次截图都是一次性把主屏副屏都截图了,但是根据设置,显示一部分。
我用
wgcp := wincapture.WGC(0)
bm_buf:= wgcp.capture()
pBitmap := Gdip_CreateBitmapFromHBITMAP(bm_buf.HBITMAP())
然后得到了pBitmap 就是主屏副屏 都有的一个长图。说明,截屏一次性截取了整个桌面。
但因为我不会处理完pBitmap后,不出问题的扔进rapidocr(在lib那里,我问的就是这个问题),所以,没法用这个方法做预处理。
所以,请问一下,wincapture.WGC()有没有参数,可以直接两块屏幕一起截屏?
Gdip_CreateBitmapFromHBITMAP(hBitmap, Palette:=0)
{
DllCall("gdiplus\GdipCreateBitmapFromHBITMAP", "UPtr", hBitmap, "UPtr", Palette, "UPtr*", &pBitmap:=0)
return pBitmap
}
The text was updated successfully, but these errors were encountered: