> I want to add support for buttons with icons to one of my
> dialogues. I have
> looked on CodeProject and found a nice CButtonST class that will do what I
> want. It expects either an icon ID, or a icon handle.
>
> The icons that I want to add to these buttons are already on my
> applications
> toolbar. Does anyone know if I can somehow get the icon id or handle from
> the apps toolbar so that I can pass it into this method? Or must I add
> individual icons into the program resources?
To get an HICON for a button on a toolbar called m_toolbar, do this:
CImageList *pImgToolbar ;
HICON hIcoButton ;
int iButtonIndex, iImageIndex ;
UINT uCmdID, uStyle ;
iButtonIndex = m_toolbar.CommandToIndex(command_id_of_button e.g.
ID_BTN_SAVE);
m_toolbar.GetButtonInfo(iButtonIndex, uCmdID, uStyle, iImageIndex);
CToolBarCtrl& rToolbarCtrl = m_toolbar.GetToolBarCtrl();
pImgToolbar = rToolbarCtrl.GetImageList();
if (pImgList != NULL)
hIcoButton = pImgToolbar->ExtractIcon(iImageIndex);
--
Jason Teagle
[EMAIL PROTECTED]
_______________________________________________
msvc mailing list
[EMAIL PROTECTED]
See http://beginthread.com/mailman/listinfo/msvc_beginthread.com for subscription
changes, and list archive.