-
August 8th, 2013, 07:56 AM
#1
How to add images to toolbar buttons for activex control mscomctl.ocx
//#import "c:\windows\SysWow64\mscomctl.ocx" raw_interfaces_only //in window7
using namespace MSComctlLib;
CComPtr<IButtons> pButtons;
CComPtr<IButton> pButton;
CComPtr<IImages> pImages;
CComPtr<IImage> pImage;
CComPtr<IDispatch> pDisp;
HRESULT hr = m_pToolbar->get_Buttons(&pButtons);
hr = pButtons->Add(NULL,NULL,NULL,NULL,NULL,&pButton);
hr = m_pImageList->get_ListImages(&pImages);
CComVariant vrIndex(1),vrImage;
hr = pImages->get_Item(&vrIndex,&pImage);//I added 3 images to imagelist
hr = pImage->QueryInterface(&pDisp);
vrImage = pDisp;
hr = pButton->put_Image(vrImage);//hr = 0x800a8b1d, why?!
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|