Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 682813
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T01:38:17+00:00 2026-05-14T01:38:17+00:00

I have the following code to take screenshots of a window: HDC WinDC; HDC

  • 0

I have the following code to take screenshots of a window:

HDC WinDC;
HDC CopyDC;
HBITMAP hBitmap;
RECT rt;

GetClientRect (hwnd, &rt);
WinDC = GetDC (hwnd);
CopyDC = CreateCompatibleDC (WinDC);

hBitmap = CreateCompatibleBitmap (WinDC,
 rt.right - rt.left, //width
 rt.bottom - rt.top);//height

SelectObject (CopyDC, hBitmap);

//Copy the window DC to the compatible DC
BitBlt (CopyDC,   //destination
 0,0,
 rt.right - rt.left, //width
 rt.bottom - rt.top, //height
 WinDC,    //source
 0, 0,
 SRCCOPY);

ReleaseDC(hwnd, WinDC);
ReleaseDC(hwnd, CopyDC);

It is someone elses code, slightly modified, as I am not really familiar with DC and how windows draws stuff to screen.

When I have one window slightly covering another, the covering window appears on screenshots of the covered one, which is kind of inconvenient. Also, when the window is minimized, this code produces nothing much interesting.

Is there any way around this? I would imagine that taking screenshots of a minimized application would be quite difficult, but I hope that getting screenshots of covered windows is possible. Perhaps there is a different method of implementing this to get around these problems?

  • 1 1 Answer
  • 1 View
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-14T01:38:17+00:00Added an answer on May 14, 2026 at 1:38 am

    No, a screenshot is exactly what it sounds like. You’ll read the pixels out of the video adapter, what you get is what you see. You’ll have to restore the window and bring it to the foreground to get the full view. WM_SYSCOMMAND+SC_RESTORE and SetForegroundWindow() respectively. Plus some time to allow the app to repaint its window if necessary.

    The WM_PRINT message is available to ask a window to draw itself into a memory context. That could handle the overlapped window problem. But that can only work if is your window. And rarely has the expected result, programmers don’t often implement WM_PRINT correctly.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the following code to take a screenshot of a window, and get
I have the following code to take an image and generate the thumbnail. how
Okay so i have a semi weridish problem with re.sub. Take the following code:
I have the following code. I would like username to take the value of
i have the following code using Nhibernate.Linq var apps = Session.Linq<History>().OrderByDescending(r => r.LastUpdated).Take(50); Console.Write(apps.Count());
I have the following code that checks the userName & userPassword is correct then
I have the following vb.net code to take the values out of a textbox
I have a simple, but perplexing problem, with Math. The following code will take
So I have the following code to take a Excel file and write it
I have following code. The query take some 30 seconds to execute. I found

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.