News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

hWnd to BMP?

Started by Bieb, March 09, 2005, 09:52:24 PM

Previous topic - Next topic

Bieb

What's the easiest way to get the contents of a window (a static control, to be exact) into a bitmap file?

petezl

Hi Bieb,
Get the windows dc for the static:
GetClientRect of Static and use measurements to create a Compatible (monochrome) bitmap.
Use GetClientRect of Static and use measurements to create a Compatible DC
Select the bitmap into it.
BitBlt the static into the Comaptible dc.
Call your BMP file creation process.
Peter.
Cats and women do as they please
Dogs and men should realise it.

Bieb

What I mean is,  how do you create the bitmap file?  Is there an API function to do it?

Tedd

I'm not sure there is. (Unless you look into the COM stuff - IPicture?)

But it's pretty simple to just write your own directly to file.
- Write header (standard, with a few options for bmp size and number of colours, etc)
- Write palette (silly ordering, but simple enough)
- Write contents (they're stored upside-down :eek)
No snowflake in an avalanche feels responsible.

Bieb

Well then, I guess I'll look up the format and then write my own library for it.  Thanks for the help.

kero

Hi, Bieb

This DoubleSnapFromPoint.zip contains source,
hope it'll help you


[attachment deleted by admin]