OCX and Picture property -> HICON. How?
Nikhil Kothari -- nkothari@bluejack.ICS.UCI.EDU
Tuesday, February 20, 1996
Hello everyone,
I am writing an OCX in VC++ 4.0, that has a picture property. This
picture property is actually an icon, which is then used in several
other Windows API calls in the form of HICON.
I have been able to get the property, get/set methods and the
CPictureHolder set up using classwizard. However, I have not been able to
get an HICON into the icon stroed in the CPictureHolder. Does anyone
know how I can get the HICON using either CPictureHolder or LPPICTUREDISP
that is returned by CPictureHolder::GetPictureDisplatch().
Please do not suggest the Render method, as I am not drawing the picture
into a DC, but using only the HICON. However, I am wondering if there is a
way to create a new icon (whose HICON I know) and then use the Render method
to draw into it.
Any help is appreciated,
Thanks in advance,
Nikhil Kothari
nkothari@ics.uci.edu
John & Annette Elsbree -- elsbree@msn.com
Thursday, February 22, 1996
HICON GetIcon(CPictureHolder& pictureHolder)
{
HICON hIcon = NULL;
LPPICTUREDISP pDisp = pictureHolder.GetPictureDispatch();
if (pDisp != NULL)
{
LPPICTURE pPic;
if (SUCCEEDED(pDisp->QueryInterface(IID_IPicture, (void**)&pPic)))
{
short sType = PICTYPE_NONE;
pPic->get_Type(&sType);
if (sType == PICTYPE_ICON)
pPic->get_Handle((OLE_HANDLE*)&hIcon);
pPic->Release();
}
pDisp->Release();
}
return hIcon;
}
John
----------
From: owner-mfc-l@netcom.com on behalf of Nikhil Kothari
I have not been able to
get an HICON into the icon stroed in the CPictureHolder. Does anyone
know how I can get the HICON using either CPictureHolder or LPPICTUREDISP
that is returned by CPictureHolder::GetPictureDisplatch().
| Вернуться в корень Архива
|