I think TortoiseSVN uses owner-draw menus.
Don't know about winrar, but this code might work even on win98 where TransparentBlt has memory leak.
Bitmap must have color table (8-bit).
Use like this (this code formatting can mangle text, so check for errors!)
//we replace magenta with menu color
ReplaceDIBColor(m_hMenuBmp, RGB(255,0,255), GetSysColor(COLOR_MENU));
//function
inline BOOL ReplaceDIBColor(HBITMAP &hDIB, COLORREF oldColor, COLORREF newColor)
{
BOOL bRet=FALSE;
//get color information
DIBSECTION ds;
if (!GetObject(hDIB, sizeof(DIBSECTION), &ds)) return FALSE;
if (ds.dsBmih.biBitCount>8) return FALSE; //must be 8 bpp max
HDC hDC=CreateCompatibleDC(NULL);
if (!hDC) return FALSE;
HBITMAP hbmpOld=(HBITMAP)::SelectObject(hDC, hDIB);
//allocate color table
UINT nColors = ds.dsBmih.biClrUsed ? ds.dsBmih.biClrUsed : 1<<ds.dsBmih.biBitCount; //bpp to UINT
RGBQUAD* ptbl=(RGBQUAD*)CoTaskMemAlloc(nColors*sizeof(RGBQUAD));
if (ptbl)
{
if (GetDIBColorTable(hDC, 0, nColors, ptbl))
{
//replace color table entries
UINT i;
for (i=0; i<nColors ; i++)
{
if (oldColor==RGB(ptbl[i].rgbRed, ptbl[i].rgbGreen, ptbl[i].rgbBlue))
{
ptbl[i].rgbRed=GetRValue(newColor);
ptbl[i].rgbGreen=GetGValue(newColor);
ptbl[i].rgbBlue=GetBValue(newColor);
bRet=TRUE;
}
}
//set new table
if (bRet)
if (!SetDIBColorTable(hDC, 0, nColors, ptbl)) bRet=FALSE;
}
//cleanup
CoTaskMemFree(ptbl);
ptbl=NULL;
bRet=TRUE;
}
else bRet=FALSE;
hDIB=(HBITMAP)::SelectObject(hDC, hbmpOld);
DeleteDC(hDC); return bRet; }