×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

Toolbar images not showing

Toolbar images not showing

Toolbar images not showing

(OP)
Hello!

I was developing on a 24-bit True Color graphics mode on Win2K.
The toolbar images were of 8-bit indexed  colors.  The images displayed as expected.
But when I changed Win2K's graphics mode to 8-bit 256 colors, the toolbar is there but no images for the buttons showed!

I'd like the images to show in all color modes.
How can I do that?

Here's the routine that displayed the toolbar. If there's a better way to do this, please help. Thanks in advance!

---
#define MAX_BUTTONS 3

HWND createTBar(HINSTANCE hInst,HINSTANCE hResource, HWND  hParentOfTBar)
{
 TBADDBITMAP tbab;
  TBBUTTON tbb[MAX_BUTTONS];
    DWORD dwStyleX = WS_CHILD | TBSTYLE_TOOLTIPS | CCS_ADJUSTABLE
                               | TBSTYLE_FLAT | TBSTYLE_TRANSPARENT ;
    int iStringForTB[MAX_BUTTONS];

    HWND hWnd = CreateWindowEx(0, TOOLBARCLASSNAME, NULL,
     dwStyleX,
   0, 0, 200, 100, hParentOfTBar, (HMENU) IDTBAR_X,  hInst, NULL);
   SendMessage(hWnd, TB_BUTTONSTRUCTSIZE,
        (WPARAM) sizeof(TBBUTTON), 0);

   colorRes= ::GetDeviceCaps(::GetDC(NULL),COLORRES);
 HIMAGELIST himl = ImageList_Create(32,32,colorRes,0,999);

 ImageList_Add(himl,

                 (HBITMAP) LoadImage(hResource,MAKEINTRESOURCE(IDBMP_CUT),IMAGE_BITMAP,0,0,
                         LR_LOADTRANSPARENT | LR_LOADMAP3DCOLORS),NULL);
    ;
   ImageList_Add(himl,
                 (HBITMAP) LoadImage(hResource,MAKEINTRESOURCE(IDBMP_COPY),IMAGE_BITMAP,0,0,
                          LR_LOADTRANSPARENT | LR_LOADMAP3DCOLORS),NULL);
    ;
  (HBITMAP) LoadImage(hResource,MAKEINTRESOURCE(IDBMP_PASTE),IMAGE_BITMAP,0,0,
                         LR_LOADTRANSPARENT | LR_LOADMAP3DCOLORS),NULL);
  
   
  SendMessage(hWnd, TB_SETIMAGELIST, 0, (LPARAM)himl);

       
        tbb[0].idCommand = IDM_CUT;
        tbb[1].idCommand = IDM_COPY;
        tbb[2].idCommand = IDM_PASTE;
 for(i=0;i<MAX_BUTTONS;i++)
    {
    tbb[i].iBitmap = i;
    tbb[i].fsState = TBSTATE_ENABLED;
    tbb[i].fsStyle = TBSTYLE_BUTTON;// TBSTYLE_BUTTON; | TBSTYLE_DROPDOWN ;   
   tbb[i].dwData = 0;
    tbb[i].iString = -1;
    }
  
    SendMessage(hWnd, TB_ADDBUTTONS, (WPARAM) MAX_BUTTONS,
        (LPARAM) (LPTBBUTTON) &tbb);
 
     SendMessage(hWnd, TB_AUTOSIZE, 0, 0
       SendMessage(hWnd,TB_SETUNICODEFORMAT, 1,0);
      
   SendMessage(hWnd, TB_SETMAXTEXTROWS, 1, 0L);
      SendMessage(hWnd, TB_SETBITMAPSIZE,
    
                 0, (LPARAM)MAKELONG(32,32));
   return hWnd;
     }
...


Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close