microsoft / Windows.UI.Composition-Win32-Samples

Windows.UI.Composition Win32 Samples
MIT License
469 stars 186 forks source link

How to capture window-content only? #74

Closed Frixs closed 3 years ago

Frixs commented 3 years ago

Hello,

how is it possible to capture only user content of selected window in ScreenCapture project?

I want to achieve to capture window without Window's control bar on the top and capture just the user content area. Similar approach is presented here using GetDC() instead of GetWindowDC() from User32

Thank you for your assistance!

robmikh commented 3 years ago

Unfortunately, capturing only the client area is not available at this time. You'll need to calculate the window's client area rect and copy that out of the buffer we provide.

You'll likely need to use a mix of ClientToScreen, DwmGetWindowAttribute, and DWMWA_EXTENDED_FRAME_BOUNDS.

BenShapira commented 1 year ago

Hey Rob, Wanted to check in if this is something that might have been added since your last comment?

robmikh commented 1 year ago

Unfortunately not.