C++ How to get layered window content image?

RL Chen 210 Reputation points

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!

A family of Microsoft operating systems that run across personal computers, tablets, laptops, phones, internet of things devices, self-contained mixed reality headsets, large collaboration screens, and other devices.
4,921 questions
Windows API - Win32
Windows API - Win32
A core set of Windows application programming interfaces (APIs) for desktop and server applications. Previously known as Win32 API.
2,470 questions
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.
3,590 questions
0 comments No comments
{count} votes

Accepted answer
  1. Castorix31 82,316 Reputation points

    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...)

    1 person found this answer helpful.

0 additional answers

Sort by: Most helpful