#if wxUSE_TOOLBAR && defined(__WIN16__)
-#if !defined(__WIN32__) && !wxUSE_IMAGE_LOADING_IN_MSW
- #error wxToolBar needs wxUSE_IMAGE_LOADING_IN_MSW under Win16
-#endif
-
#if !defined(__GNUWIN32__) && !defined(__SALFORDC__)
#include "malloc.h"
#endif
WXHBITMAP wxToolBar::CreateMappedBitmap(WXHINSTANCE hInstance, WXHBITMAP hBitmap)
{
- HANDLE hDIB = wxBitmapToDIB((HBITMAP) hBitmap, 0);
- if (hDIB)
- {
-#ifdef __WINDOWS_386__
- LPBITMAPINFOHEADER lpbmInfoHdr = (LPBITMAPINFOHEADER)MK_FP32(GlobalLock(hDIB));
-#else
- LPBITMAPINFOHEADER lpbmInfoHdr = (LPBITMAPINFOHEADER)GlobalLock(hDIB);
-#endif
- HBITMAP newBitmap = (HBITMAP) CreateMappedBitmap((WXHINSTANCE) wxGetInstance(), lpbmInfoHdr);
- GlobalUnlock(hDIB);
+ HANDLE hDIB = wxDIB::ConvertFromBitmap((HBITMAP) hBitmap);
+ if ( !hDIB )
+ return 0;
+
+ WXHBITMAP newBitmap = CreateMappedBitmap(hInstance, GlobalPtr(hDIB));
+
GlobalFree(hDIB);
- return (WXHBITMAP) newBitmap;
- }
- return 0;
+
+ return newBitmap;
}
-#endif
+#endif // wxUSE_TOOLBAR
+