简体   繁体   中英

DirectShow Filter to grab a specific window

I saw another question that sounds almost the same but the answers seem to be about whole desktop screen capture: DirectShow Source filter using Dekstop window as source .

I have looked at the PushSource and yes it does what it is meant to do, however I want the virtual webcam to grab a specific window (similar to how you can select to share a window in Skype's share screen).

How would I go about selecting a specific window as a capture for the virtual webcam? is there a specific method already in the DirectShow API that I don't know about that does this?

There is no specific method. Moreover the part of the sample that grabs from screen is already outside of DirectShow API, it is GDI instead.

So the solution is pretty simple, you GetWindowRect position of your window, and then grab from screen only this rectangle, not the whole desktop. Or instead, you can send WM_PAINT or WM_PRINTCLIENT to the window in order to request its paint into provided device context.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM