-
LoadMappedBitmap
I have not been successful in converting from using LoadBitmap to LoadMappedBitmap. I am trying to overcome a problem with the button face in my toolbar bitmap which was created in an image editing tool to be the correct color. Using LoadMappedBitmap causes some terrible problem (it takes for ever for the application to load and the toolbar buttons are totally clobbered with noise). This is the relevant code. What am I doing wrong?
Thanks, Bob
COLORMAP clrMap[] =
{ RGB(192,192,192), ::GetSysColor(COLOR_APPWORKSPACE),
RGB(207,200,207), ::GetSysColor(COLOR_3DFACE),
RGB(255,255,255), ::GetSysColor(COLOR_3DHIGHLIGHT),
RGB(0,0,0), ::GetSysColor(COLOR_3DSHADOW) };
if (!m_TBNav.Create(this, WS_CHILD | WS_VISIBLE | CBRS_TOP
| CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC, IDR_TBNAV))
{
TRACE0("Failed to create toolbar\n");
return -1; // fail to create
}
m_NavBitmap.LoadMappedBitmap(IDB_NAVIGATION, 0, (COLORMAP*)&clrMap, 3);
// should this be 3 or 4 for map size ?? -- using 4 doesn't solve problem
m_TBNav.SetBitmap((HBITMAP)(m_NavBitmap));
m_TBNav.SetButtons(NavIDs, sizeof(NavIDs)/sizeof(UINT));
-
Re: LoadMappedBitmap
clrMap is an array of COLORMAP structures. In your call to LoadMappedBitmap you are passing &clrMap, which means the address of the array. I think that if you remove the &, everything should work, and you should be able to remove the cast.