943,741 Members | Top Members by Rank

Ad:
  • C++ Discussion Thread
  • Unsolved
  • Views: 976
  • C++ RSS
May 31st, 2009
0

How do I use custom icons for toolbar?

Expand Post »
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:
CPP Syntax (Toggle Plain Text)
  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.
Similar Threads
Reputation Points: 18
Solved Threads: 2
Light Poster
killdude69 is offline Offline
45 posts
since Jul 2008
Jun 1st, 2009
-1

Re: How do I use custom icons for toolbar?

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.
Reputation Points: 18
Solved Threads: 2
Light Poster
killdude69 is offline Offline
45 posts
since Jul 2008

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in C++ Forum Timeline: std::map with char*
Next Thread in C++ Forum Timeline: WinAPI Dialogs class without MFC





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC