Jump to content
  • Advertisement

Archived

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

Xgkkp

Taking and saving a screenshot

This topic is 5270 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, Basically, I want to take a screenshot and then save it as a jpg (or another browser readable file type), but there seems to be relatively little information about this on the net. I have found plenty of "Screenshot programs" but that's overkill, and besides, I want to run it from the command line, and learn by writing it 'myself' (I'm using MSVC++ 6). Basically, I'm doing a little experiment with controlling my pc from a remote web page, via apache and php. mouse clicks are sorted, but I still need to update the screenshot manually. (I can't find a way to do it directly from php either) Thanks a lot, Nick [edited by - Xgkkp on February 6, 2004 10:05:09 AM]

Share this post


Link to post
Share on other sites
Advertisement
Creating a screenshot is usually done by using GetDesktopWindow() to acquire a handle to the desktop. The you snag the desktop''s device context and create a compatible device context (usually via a memory bitmap) and BitBlt() to the new device context with SRCCOPY. If you use a MFC CImage class for destination device context you can just use CImage::Save() to write the image to a file. CImage::Save() should support BMP, PNG, JPEG and GIF file formats.

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
www.codeproject.com

search for "Screen Capture"

Share this post


Link to post
Share on other sites
The following creates a handle to a device context with the screen''s current image, which you can then BitBlt() to your own HDC and do stuff with:


HDC hDCScreen = CreateDC("DISPLAY", NULL, NULL, NULL);

... (Do stuff with hDCScreen)

DeleteDC(hDCScreen);

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!