Note that there are some explanatory texts on larger screens.

plurals
  1. POGet Thumbnail of background window
    text
    copied!<p>I'm trying to get thumbnail pictures of windows that are not visible.</p> <p>Here's the code I have so far</p> <pre><code>BOOL CALLBACK WindowProc(HWND hWnd, LPARAM lParam) { RECT WindRect; GetWindowRect(hWnd, &amp;WindRect) CurrentScreenShot-&gt;Next = new ScreenShotList(); CurrentScreenShot = CurrentScreenShot-&gt;Next; HDC SourceDC = GetDC(hWnd); HDC TargetDC = CreateCompatibleDC(SourceDC); CurrentScreenShot-&gt;ScreenShot = CreateCompatibleBitmap(SourceDC, WindRect.right - WindRect.left, WindRect.bottom - WindRect.top); BitBlt(TargetDC, 0, 0, WindRect.right - WindRect.left, WindRect.bottom - WindRect.top, SourceDC, 0, 0, SRCCOPY); ReleaseDC(hWnd, SourceDC); g_iWindows++; return TRUE; } </code></pre> <p>For now, <code>WindowProc</code> is being called directly using <code>FindWindow</code> to get a handle, though, I eventually want to use <code>EnumWindows</code> to loop through all of the windows to get their thumbnails and store them in a linked list.</p> <pre><code>WindowProc(FindWindow(NULL, L"File Explorer"), 0); </code></pre> <p>This code is in a DLL, which is called from a C# Forms application. For now the C# application just takes the bitmap and saves it to a file.</p> <p>The problem is that unless I use <code>FindWindow</code> to get the visible window (which also happens to be the C# application), the picture ends up being a black box.</p> <p>Is it possible to get an picture of a background window?</p> <p><strong>EDIT</strong>: This is a Windows Mobile application</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload