Click to See Complete Forum and Search --> : How to add a picture in CImageList1(ActiveX control)?


Thomas
March 29th, 1999, 02:56 PM
I've added several ActiveX controls to my project, including CImage, CImages,

CImageList1. But I can't successfully add a picture to the CImageList1 objct.

Below is part of my program. I used debug to trace my program and error occured

at the last line.

CImage myImage;

CImages myImages;

CImageList1 myImageList;

CPictureHolder pict;

VARIANT var1, var2, var3;

pict.CreateFromBitmap(IDB_BMWORD);

myImage.SetRefPicture(pict.GetPictureDispatch());

var1.vt = VT_i4;

var1.lVar = (long) 1;

var2.vt = VT_BSTR;

var2.bstr = CString("picture1");

var3.vt = VT_DISPATCH;

var3.ppdispVal = (&myImage.m_lpDispatch);

myImages.Add(&vtv1, &vtv2 ,&tvariant);

m_ImageList1.SetRefListImages(m_Images.m_lpDispatch); // error occured.