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.
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.
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 11:34 AM.