diff --git a/src/msw/app.cpp b/src/msw/app.cpp index fd8d8e723a..f29afe759c 100644 --- a/src/msw/app.cpp +++ b/src/msw/app.cpp @@ -779,7 +779,7 @@ int wxEntry(WXHINSTANCE hInstance, wxCHECK_MSG( wxTheApp, 0, wxT("You have to define an instance of wxApp!") ); // save the WinMain() parameters - if (lpCmdLine) // MicroWindows pass NULL for this + if (lpCmdLine) // MicroWindows passes NULL wxTheApp->ConvertToStandardCommandArgs(lpCmdLine); wxTheApp->m_nCmdShow = nCmdShow; diff --git a/src/msw/ole/dataobj.cpp b/src/msw/ole/dataobj.cpp index 29c0d6f8e5..65151fbf5e 100644 --- a/src/msw/ole/dataobj.cpp +++ b/src/msw/ole/dataobj.cpp @@ -1260,8 +1260,15 @@ wxBitmap wxConvertDIBToBitmap(const LPBITMAPINFO pbmi) // BITMAPINFO starts with BITMAPINFOHEADER followed by colour info const BITMAPINFOHEADER *pbmih = &pbmi->bmiHeader; + // biClrUsed has the number of colors, unless it's 0 + int numColors = pbmih->biClrUsed; + if (numColors==0) + { + numColors = wxGetNumOfBitmapColors(pbmih->biBitCount); + } + // offset of image from the beginning of the header - DWORD ofs = wxGetNumOfBitmapColors(pbmih->biBitCount) * sizeof(RGBQUAD); + DWORD ofs = numColors * sizeof(RGBQUAD); void *image = (char *)pbmih + sizeof(BITMAPINFOHEADER) + ofs; ScreenHDC hdc;