Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

DarkEldar77

Taking Screenshots?

This topic is 5988 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi, I am using MFC and I was wondering is there a way I could take screenshots by using the program. (Not by using the keyboard) Thank You In Advance, Daniel

Share this post


Link to post
Share on other sites
Advertisement
Screenshots of your window or the entire screen?

For screen, use HDC hDC = GetDC(NULL).
For client area, use HDC hDC = GetDC(hWnd);
For the entire window, use HDC hDC = GetWindowDC(hWnd);

Then, read the bitmap as described here. Remember to release DC when you''re done.

Share this post


Link to post
Share on other sites
Yeah, there is. You need to call GetDesktopWindow to obtain the handle of the desktop, and call GetDC to get the device context. Then create a memory DC by calling CreateCompatibleDC. You will also need to create a compatible bitmap, by calling CreateCompatibleBitmap and SelectObject it into the memory DC. BitBlt the desktop DC to the memory DC, and that will put the screenshot into the memory DC.

Hope this helps!

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!