how do i save the content of a hdc(handle device context) to a file

This is a discussion on how do i save the content of a hdc(handle device context) to a file within the Windows Programming forums, part of the Platform Specific Boards category; how do i save the content of a hdc(handle device context) to a file. I have captured the screen and ...

  1. #1
    Registered User
    Join Date
    Apr 2002
    Posts
    12

    how do i save the content of a hdc(handle device context) to a file

    how do i save the content of a hdc(handle device context) to a file. I have captured the screen and want to save it to a file.

  2. #2
    Used Registerer jdinger's Avatar
    Join Date
    Feb 2002
    Posts
    1,065
    First off get familiar with the structure of a bitmap file. Check out www.wotsit.org for more info. Anyway first you have to use GetObject to load the HDCs properties into an HBITMAP. From there you create your BITMAPINFO structure. Next you get the size of your image data bits (the size will be your biSizeImage and use GetDIBits to get the data), create your BITMAPFILEHEADER then write them to a file in order (BITMAPFILEHEADER, BITMAPINFO (BITMAPINFOHEADER/color table) and image data.

    Check out MSDN they've got complete source on how to do it.
    Last edited by jdinger; 05-09-2002 at 12:34 PM.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Totally confused on assigment using linked lists
    By Uchihanokonoha in forum C++ Programming
    Replies: 8
    Last Post: 01-05-2008, 04:49 PM
  2. Can we have vector of vector?
    By ketu1 in forum C++ Programming
    Replies: 24
    Last Post: 01-03-2008, 05:02 AM
  3. Inventory records
    By jsbeckton in forum C Programming
    Replies: 23
    Last Post: 06-28-2007, 05:14 AM
  4. System
    By drdroid in forum C++ Programming
    Replies: 3
    Last Post: 06-28-2002, 11:12 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21