Getting error when putting picture on button

M

Matrixinline

Hi All,

I am getting error for the following code can you just let me know
what solution I need to implement so as to get transparent image on
CommandBarButton


1.) Using IPictureDisp, but this gives me theerror "wrong parameter".

HICON hIcon = LoadIcon(AfxGetApp()->m_hInstance,
MAKEINTRESOURCE(IDI_ICON));

PICTDESC pictdesc;
pictdesc.cbSizeofstruct = sizeof(PICTDESC);
pictdesc.picType = PICTYPE_ICON;
pictdesc.icon.hicon = hIcon;
IPictureDispPtr pPicture = NULL;
HRESULT hr = OleCreatePictureIndirect(&pictdesc, IID_IPictureDisp,
TRUE, (void**)&pPicture);
if (!FAILED(hr))
{ try
{ pButton->PutPicture(pPicture);
}
catch(_com_error e)
{ MessageBox(NULL, e.ErrorMessage(), _T("ERROR"), MB_OK);
}
}
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top