CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Apr 1999
    Posts
    123

    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));




  2. #2
    Join Date
    Aug 1999
    Posts
    18

    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.


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured