Article View: comp.windows.ms
Article #1985Re: Need Help: Saving and restoring bitmaps on disk
From: Paul Moody
Date: Mon, 13 Nov 1989 15:34
Date: Mon, 13 Nov 1989 15:34
31 lines
1456 bytes
1456 bytes
In article <2002@altger.UUCP>, darkness@altger.UUCP (darkness) writes:
> Is there any *easy* way to save a bitmap? The format doesn't matter,
> it should only work, that's all. It also need not to be device independent,
Yes, call GetObject to load a bitmap data structure and then
GetBitMapBits to get a pointer to the bits.
EG:
void WriteBits(hBitmap)
HBITMAP hBitmap;
{
LONG lBits;
BITMAPT bitmap;
LPSTR lpBitmap;
HANDLE hBitdata;
GetObject(hBitmap, sizeof(BITMAP), (LPSTR)&bitmap);
lBits = bitmap.bmHeight * bitmap.bmWidthBytes;
hBitdata = GlobalAlloc(GM_MOVEABLE, lBits);
lpBitmap = GlobalLock(hBitdata);
GetBitMapBits(hBitmap, lBits, lpBitmap);
_lwrite(file, (LPSTR)&bitmap, sizeof(BITMAP));
_lwrite(file, lpBitmap, lbits);
GlobalUnlock(hBitdata);
GlobalFree(hBitdata);
}
--
Paul Moody UUCP: rutgers!cscnj!paul
Computer Sciences Corporation
# the opinions expressed are entirely imaginary #
Technical Details
Message-ID:
<500@cscnj.csc.COM>Path:
arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!wuarchive!psuvax1!rutgers!cscnj!paulReferences:
<2002@altger.UUCP>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!wuarchive!psuvax1!rutgers!cscnj!paul From: paul@cscnj.csc.COM (Paul Moody) Newsgroups: comp.windows.ms Subject: Re: Need Help: Saving and restoring bitmaps on disk Summary: GetBitMapBits Keywords: Bitmaps Storage Message-ID: <500@cscnj.csc.COM> Date: 13 Nov 89 15:34:48 GMT References: <2002@altger.UUCP> Organization: Computer Sciences Corp., Piscataway NJ Lines: 31