[comp.windows.ms] Bitmaps again...HELP

cig@genrad.com (Charles I. Ganimian Jr.) (08/25/89)

Hello,
	I would like to take a bitmap that I display in an app
	and save it to a bitmap file to be included in an app
	in the resource file.

	The problem (as described earlier) I have a bitmap in a file
	that is displayed on startup of my app.  This bitmap needs
	to be changed, but... I don't know how it was created.
	I have tried ever tool I can find (see list in previous msg)
	with no luck so now I want to do the following.

	1st use snap to bring it into the clipboard then use paint
	(or whatever) to modify it then put it back into the clipboard.
	Next write an app which removes it from the clipboard and writes 
	it to a file.  Is this possible?? Anybody have a clues.
	
	This can be your problem too if you don't do documentation!


					thanks for any help

					charlie g.

ps I did not create this bitmap, I might have documented how I did it,
   in the future I definitely would require anyone I work with to 
   document how they do things or die...

michaelt@microsoft.UUCP (Michael Thurlkill 1/1029) (08/29/89)

In article <25217@genrad.UUCP> cig@genrad.com (Charles I. Ganimian Jr.) writes:
>
>
>	1st use snap to bring it into the clipboard then use paint
>	(or whatever) to modify it then put it back into the clipboard.
>	Next write an app which removes it from the clipboard and writes 
>	it to a file.  Is this possible?? Anybody have a clues.
>	
This is definitely possible.
In fact the "ClipBits" sample that comes with the SDK is structured
to do just this. However, the 'Save' portion isn't emplemented, even
though the menu selection is there. You could emplement this yourself
pretty easily. Basically, you want to grab the bitmap off the clipboard,
call GetBitmapBits to get the bitmap data, write out the following   
header, and then write out the bits. Reading the file would be sort of
the reverse.

Bitmap header:

typedef struct {
    WORD  dummy1;
    short bmType;
    short bmWidth;
    short bmHeight;
    short bmWidthBytes;
    BYTE  bmPlanes;
    BYTE  bmBitsPixel;
    DWORD dummy2;
} BMFILEHDR;

This is basically the same as the bitmap structure listed in the
Data Structure section of the reference manual.

Good luck,
Mike

Disclaimer: These thoughts and opinions are mine and noone elses.
            They shouldn't be misconstrued as being correct or
            related to my employer.