How do I use custom icons for toolbar?

Please support our C++ advertiser: Intel Parallel Studio Home
Reply

Join Date: Jul 2008
Posts: 45
Reputation: killdude69 is an unknown quantity at this point 
Solved Threads: 1
killdude69 killdude69 is offline Offline
Light Poster

How do I use custom icons for toolbar?

 
0
  #1
May 31st, 2009
Okay, I have been googling and looking on MSDN for this for a couple hours or so, and I will continue to do so until somebody replies. I need some help on a program I am making in my free time.

Can sombody tell me what would be a good way to create my own icon list to use in a toolbar. I have a toolbar, and I don't like the look of the IDB_STD_SMALL_COLOR icon list. I would really like to make my own, and I can make the icons, I just need to know how I can create my own list of icons. But there is a catch, it can't use any resource scripts.

I am not looking for somebody to just hand me a script and say "here you go", I would like either a small tutorial by you, or a link to a tutorial.

I have an idea of how I could do it:
  1. TBBUTTON btn[12];
  2. TBADDBITMAP bmp;
  3. HINSTANCE hInst = GetModuleHandle(NULL);
  4.  
  5. bmp.hInst = hInst;
  6. //bmp.nID = IDB_STD_LARGE_COLOR; // Can I just not set nID?
  7. SendMessage(toolbar, TB_ADDBITMAP, 0, (LPARAM)&bmp);
  8. ZeroMemory(btn, sizeof(btn));
  9.  
  10. btn[0].iBitmap = LoadIcon(hInst, "new.ico");
  11. btn[0].fsState = TBSTATE_ENABLED | TBSTATE_WRAP;
  12. btn[0].fsStyle = TBSTYLE_BUTTON;
  13. btn[0].idCommand = CTRL_MENU_FILE_NEW;
  14. // ...

But this doesn't work, because iBitmap is an integer. So there must be some way. I have heard of image lists, and looked them up on MSDN, but I don't understand them. They are just numbers, where do the actual filenames come into play?

Summary: How to set my own icons for a toolbar.
Reply With Quote Quick reply to this message  
Join Date: Jul 2008
Posts: 45
Reputation: killdude69 is an unknown quantity at this point 
Solved Threads: 1
killdude69 killdude69 is offline Offline
Light Poster

Re: How do I use custom icons for toolbar?

 
-1
  #2
Jun 1st, 2009
Why isn't anybody answering me? This was the last place I looked and still nobody cares. It's not like I haven't tried, I have worked my ass of trying to do this. I know somebody knows how to do this, and several people who do saw my thread and didn't bother to help.

I got my icons, and I define the bitmap an define the offset in the iBitmap property, but it still doesn't work, and I was following a tutorial. I can't find any other place that has information on this.

They all use the STD library.

So seriously, somebody answer me please.
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the C++ Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC