Share via

C++ How to get layered window content image?

RL Chen 265 Reputation points
2024-05-17T13:18:09.3866667+00:00

My goal is to get an HDC of an image or image of the contents of a layered window in Windows 7 and above.

I tried PrintWindow(hwndMag, hdcDest, PW_RENDERFULLCONTENT), but this requires Windows 8.1. Note that layered windows may contain transparency, or be obscured, and I need a solution that meets the above requirements, thanks!

Windows development | Windows API - Win32
Windows for business | Windows Client for IT Pros | User experience | Other
Developer technologies | C++
Developer technologies | C++

A high-level, general-purpose programming language, created as an extension of the C programming language, that has object-oriented, generic, and functional features in addition to facilities for low-level memory manipulation.

0 comments No comments

Answer accepted by question author

Castorix31 91,876 Reputation points
2024-05-17T14:05:13.5633333+00:00

DwmRegisterThumbnail detects transparency

It can de drawn on a background with a given color (then I used D3DXSaveSurfaceToFileInMemory in an old test to get the resulting bitmap bits, but not sure if it is necessary...)

Was this answer helpful?

1 person found this answer helpful.

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.