CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Dec 2007
    Location
    Australia
    Posts
    151

    Adding a bitmap to a toolbar button why isn't this working?

    Code:
    TBBUTTON tbb[1];
    TBADDBITMAP tbab;
    tbab.hInst = HINST_COMMCTRL;
    tbab.nID = IDB_STD_SMALL_COLOR;
    SendMessage(mainTB, TB_ADDBITMAP, 0, (LPARAM)&tbab);
    
    ZeroMemory(tbb, sizeof(tbb));
    
    tbb[0].iBitmap = IDB_BGGBTN_GRAY; //this line for my button image (i think)
    tbb[0].fsState = TBSTATE_ENABLED;
    tbb[0].fsStyle = TBSTYLE_BUTTON;
    tbb[0].idCommand = MAINTB_MAINMENU;
    IDB_BGGBTN_GRAY is defined in my resource editor (VC++)

    I added the file into my resources file, and named it IDB_BGGBTN_GRAY

    but it doesn't show...

    Does anyone know why?

    Thanks

  2. #2
    Join Date
    Aug 2004
    Posts
    294

    Re: Adding a bitmap to a toolbar button why isn't this working?

    You must not use
    Code:
    tbab.hInst = HINST_COMMCTRL;
    unless you want to use a system bitmap. Use the application's HINSTANCE or the HINSTANCE of a .dll depending on where the resource is located.
    Boris Karadjov
    Brainbench MVP for Visual C++
    http://www.brainbench.com/

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