I'm using the GDI+ (Visual Studio 2003 and higher) CImage class to load
a bitmap. But once you have the handle to a valid bitmap, try the
following
CImage image;
HRESULT hr = image.Load("c:\\rotatetest.bmp");
if(SUCCEEDED(hr))
{
PICTDESC pictDesc;
memset(&pictDesc, 0, sizeof(pictDesc));
pictDesc.cbSizeofstruct = sizeof(pictDesc);
pictDesc.picType = PICTYPE_BITMAP;
pictDesc.bmp.hbitmap = (HBITMAP)image;
image.Detach();
CComPtr<IPictureDisp> picture;
hr =
OleCreatePictureIndirect(&pictDesc, IID_IPictureDisp, TRUE,
(void**)&picture);
if (SUCCEEDED(hr))
{
CNiPicture pic(picture.Detach(), true);
m_graph.Annotations.Item(1).Shape.Image.Picture = pic;
}
}
I hope this helps
Bilal Durrani
NI