darkness@altger.UUCP (darkness) (11/10/89)
Dear Windows-cracks I have a little problem writing an Mandelbrot-generator for windows in C It already works fine, but I have to save the bitmap associated with my main window to disk and of course be able restore and display it later on. 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, because the files are merely temporary. I could only imagine to calculate the length of the bitmap in memory and then write the BITMAP-structure and the Bitmap-Bits to disk, but this seems too complicated to be the only way. Greets, ------------------------------------------------------------------ Stefan Willmeroth Write a program even idiots can use, Munich/Germany and you will see that only idiots will altger want to use it. (Murphy) ------------------------------------------------------------------
paul@cscnj.csc.COM (Paul Moody) (11/13/89)
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 #