Unfortunately, this is true and it is not trivial - you could base a
dissertation on it. The steps look something like this...
1. GetDC from the window hwnd
2. Use CreateCompatibleDC to create a memory DC based on the DC from 1
3. Use CreateDIBSection to access the "bits" of the window's image
4. Use SelectObject to select the dib section into the memory DC
5. BitBlt the image from the window DC into the memory DC
6. Copy the DIB section bits to a buffer (you got a pointer in 3)
7. Reselect the previous bitmap (returned from 4) into the memory DC with
SelectObject
8. DeleteObject on the dib section
Now you can save the BITMAPFILEHEADER, BITMAPINFOHEADER, and dib section to
a file. One caveat is that the DC of the window holds 16-bit pixel data
packed as 555 or 565 so you need to use the biCompression member and specify
the masking of the RGB components.
Fortunately, loading it is easy! You can just load it right into a Bitmap
object. I hope this helps.
--
Geoff Schwab
Program Manager
Excell Data Corporation
http://msdn.com/mobility
This posting is provided "AS IS" with no warranties, and confers no rights.