> 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);
I managed to get some code compiling. But I don't think I can go down this road after all. The dialogue that has the buttons on is created early in the program as a modelless dialogue. I used this in my dialogues OID handler: CMainFrame *pWnd = (CMainFrame*)AfxGetMainWnd(); hIcon = pWnd->GetToolbarIcon(ID_FILE_NEW); The GetToolbarIcon asserts on m_wndToolBar.CommandToIndex(uID). The ASSERT(this) fails. Seems like the toolbar or not yet created or something at the time I need the handle to the icon. Andrew This email and any attached files are confidential and copyright protected. If you are not the addressee, any dissemination of this communication is strictly prohibited. Unless otherwise expressly agreed in writing, nothing stated in this communication shall be legally binding. _______________________________________________ msvc mailing list [EMAIL PROTECTED] See http://beginthread.com/mailman/listinfo/msvc_beginthread.com for subscription changes, and list archive.
