+
+ // the mask returned by GetIconInfo() is inversed compared to the usual
+ // wxWin convention
+ HBITMAP hbmpMask = ::CreateBitmap(w, h, 1, 1, 0);
+
+ // the icons mask is opposite to the usual wxWin convention
+ HDC dcSrc = ::CreateCompatibleDC(NULL);
+ HDC dcDst = ::CreateCompatibleDC(NULL);
+ (void)SelectObject(dcSrc, iconInfo.hbmMask);
+ (void)SelectObject(dcDst, hbmpMask);
+
+ HBRUSH brush = ::CreateSolidBrush(RGB(255, 255, 255));
+ RECT rect = { 0, 0, w, h };
+ FillRect(dcDst, &rect, brush);
+
+ BitBlt(dcDst, 0, 0, w, h, dcSrc, 0, 0, SRCINVERT);
+
+ SelectObject(dcDst, NULL);
+ SelectObject(dcSrc, NULL);
+ DeleteDC(dcDst);
+ DeleteDC(dcSrc);
+
+ refData->m_bitmapMask = new wxMask((WXHBITMAP)hbmpMask);