I am new to programming, so please bear with my ingorance...
To begin, I have no problem adding the standard controls to my toolbar, such
as STD_FILENEW, and so on, but I can't figure out how to add my own
customized icon to a button on the toolbar.
I've added the icon to my resource file and assigned an ID value to it, and
I've also used LoadIcon or LoadImage just to try to make it work, but no
matter what I do, when I code the following --
tbb[2].iBitmap = IDI_MYICON;
tbb[2].fsState = TBSTATE_ENABLED;
tbb[2].fsStyle = TBSTYLE_BUTTON;
tbb[2].idCommand = IDM_CLOSE;
-- the button shows up but not the icon, i.e., it's just a flat gray area
with no icon, even though the button is fully functional.
Please tell me what I am missing.
Mark Salsbery [MVP] - 28 Jan 2008 18:43 GMT
> I am new to programming, so please bear with my ingorance...
>
[quoted text clipped - 9 lines]
>
> tbb[2].iBitmap = IDI_MYICON;
iBitmap should be the index of the bitmap in the imagelist associated with
the toolbar, not a resource ID.
An icon can be added to an imagelist using ImageList_ReplaceIcon().
Mark

Signature
Mark Salsbery
Microsoft MVP - Visual C++
> tbb[2].fsState = TBSTATE_ENABLED;
> tbb[2].fsStyle = TBSTYLE_BUTTON;
[quoted text clipped - 4 lines]
>
> Please tell me what I am missing.
Lamblion - 29 Jan 2008 00:25 GMT
Thank you very much, Mark. I will give this a go and see how I fare.
> > I am new to programming, so please bear with my ingorance...
> >
[quoted text clipped - 25 lines]
> >
> > Please tell me what I am missing.