--- mstools/samples/mandel/savebmp.c 2018/08/09 18:20:41 1.1.1.1 +++ mstools/samples/mandel/savebmp.c 2018/08/09 18:21:38 1.1.1.2 @@ -18,6 +18,8 @@ * #include "jtypes.h" * \**************************************************************************/ +//#define STRICT +//#define MYERROR 1 #include #include "jtypes.h" @@ -55,6 +57,13 @@ BOOL SaveBitmapFile(HDC hDC, HBITMAP hBm ULONG sizBMI; +#if MYERROR + sprintf( gtext,"MYERROR\n"); + OutputDebugString( gtext); +#endif + + + bSuccess = TRUE; if (!hBmp) { MessageBox(ghwndMain, "There's no Bitmap to save!", "Error", MB_OK); @@ -78,7 +87,7 @@ BOOL SaveBitmapFile(HDC hDC, HBITMAP hBm // the actual bits // if ((pBits = (PBYTE)GlobalAlloc(GMEM_FIXED | GMEM_ZEROINIT, - bmi.bmiHeader.biWidth * bmi.bmiHeader.biHeight)) == NULL) { + bmi.bmiHeader.biSizeImage)) == NULL) { MessageBox(ghwndMain, "Failed in Memory Allocation for pBits!", "Error", MB_OK); return FALSE; } @@ -111,6 +120,7 @@ BOOL SaveBitmapFile(HDC hDC, HBITMAP hBm pbmi->bmiHeader.biClrUsed = bmi.bmiHeader.biClrUsed; pbmi->bmiHeader.biClrImportant = bmi.bmiHeader.biClrImportant; #endif + // // Now that we've a bigger chunk of memory, let's copy the Bitmap // info header data over @@ -173,6 +183,7 @@ BOOL SaveBitmapFile(HDC hDC, HBITMAP hBm MessageBox(ghwndMain, "Failed in creating bitmap!", "Error", MB_OK); bSuccess = FALSE; goto ErrExit3; + } //