Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17


Saving a Windows Drawing as a Bitmap or Picture File

Posted on 1999-07-01
Medium Priority
Last Modified: 2010-04-15
I am using Visual C++ 6.0 to make a drawing.
I wish to now save the whole drawing (whether it is all
visible or not) as a standard image file
(bitmap, JPG, GIF, whatever). I don't want to do it with
the Print Screen key, which would copy it into the ClipBoard, and only copy what you see.
I need to automatically save it as a separate file.
How can this be done ? Please provide detailed example.
Question by:oppenheim
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
LVL 14

Accepted Solution

AlexVirochovsky earned 380 total points
ID: 1263121
You can easy save you Screen as Bitmap:
1. Make hBitmap (left, top,right, bottom: saved Rect)
HDC hdc, mdc;
  HBITMAP hOld, hBitmap;
  int left, right, top, bottom;

  hdc = GetDC(NULL);
  iBits  = GetDeviceCaps(hdc,BITSPIXEL);
  hBitmap = CreateBitmap(right-left, bootom-top, 1, iBits, NULL);
  mdc = CreateCompatibleDC(hdc);
  hOld = (HBITMAP)SelectObject(mdc, hBitmap);
  BitBlt(mdc, left, top,right, bottom, hdc, 0, 0,SRCCOPY);    //clipping!
  SelectObject(mdc, hOld);
  ReleaseDC (NULL, hdc);
2. Save hBitmap as file see


Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

An Outlet in Cocoa is a persistent reference to a GUI control; it connects a property (a variable) to a control.  For example, it is common to create an Outlet for the text field GUI control and change the text that appears in this field via that Ou…
This tutorial is posted by Aaron Wojnowski, administrator at  To view more iPhone tutorials, visit This is a very simple tutorial on finding the user's current location easily. In this tutorial, you will learn ho…
The goal of this video is to provide viewers with basic examples to understand how to use strings and some functions related to them in the C programming language.
Video by: Grant
The goal of this video is to provide viewers with basic examples to understand and use while-loops in the C programming language.

705 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question