- BITMAP bm;
- BITMAPINFOHEADER bi;
- BITMAPINFOHEADER FAR *lpbi;
- DWORD dwLen;
- HANDLE hdib;
- HANDLE h;
- HDC hdc;
-
- if (!hbm)
- return NULL;
- if (hpal == NULL)
- hpal = GetStockObject(DEFAULT_PALETTE);
-
- GetObject(hbm, sizeof (bm), (LPSTR) &bm);
-
- if (biBits == 0)
- biBits = bm.bmPlanes * bm.bmBitsPixel;
-
- bi.biSize = sizeof(BITMAPINFOHEADER);
- bi.biWidth = bm.bmWidth;
- bi.biHeight = bm.bmHeight;
- bi.biPlanes = 1;
- bi.biBitCount = biBits;
- bi.biCompression = biStyle;
- bi.biSizeImage = 0;
- bi.biXPelsPerMeter = 0;
- bi.biYPelsPerMeter = 0;
- bi.biClrUsed = 0;
- bi.biClrImportant = 0;
-
- dwLen = bi.biSize + wxPaletteSize(&bi);
-
- hdc = GetDC((HWND) NULL);
- hpal = SelectPalette(hdc, hpal, FALSE);
- RealizePalette(hdc);
-
- hdib = GlobalAlloc(GHND, dwLen);
-
- if (!hdib) {
- SelectPalette(hdc, hpal, FALSE);
- ReleaseDC(NULL, hdc);
- return NULL;
- }
+ BITMAP bm;
+ BITMAPINFOHEADER bi;
+ BITMAPINFOHEADER FAR *lpbi;
+ DWORD dwLen;
+ HANDLE hdib;
+ HANDLE h;
+ HDC hdc;
+
+ if (!hbm)
+ return NULL;
+
+ if (hpal == NULL)
+ hpal = GetStockObject(DEFAULT_PALETTE);
+
+ GetObject(hbm, sizeof (bm), (LPSTR) &bm);
+
+ if (biBits == 0)
+ biBits = bm.bmPlanes * bm.bmBitsPixel;
+
+ bi.biSize = sizeof(BITMAPINFOHEADER);
+ bi.biWidth = bm.bmWidth;
+ bi.biHeight = bm.bmHeight;
+ bi.biPlanes = 1;
+ bi.biBitCount = biBits;
+ bi.biCompression = biStyle;
+ bi.biSizeImage = 0;
+ bi.biXPelsPerMeter = 0;
+ bi.biYPelsPerMeter = 0;
+ bi.biClrUsed = 0;
+ bi.biClrImportant = 0;
+
+ dwLen = bi.biSize + wxPaletteSize(&bi);
+
+ hdc = GetDC((HWND) NULL);
+ hpal = SelectPalette(hdc, hpal, FALSE);
+ RealizePalette(hdc);
+
+ hdib = GlobalAlloc(GHND, dwLen);
+
+ if (!hdib) {
+ SelectPalette(hdc, hpal, FALSE);
+ ReleaseDC(NULL, hdc);
+ return NULL;
+ }