For Programmers: Free Programming Magazines  


Home > Archive > Visual Basic Controls > January 2006 > Help!! How to get handle of a bitmap in an ActiveX control in Windows CE!









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Help!! How to get handle of a bitmap in an ActiveX control in Windows CE!
vkinra@hotmail.com

2006-01-30, 7:05 pm

Hi,

Basically, I want to create an ActiveX control button that displays
different images in different states (up, down, etc). I want to be able
to select the images by entering their name in the ActiveX's property
from its container after I insert it into the dialog.
I am running into a brick wall trying to place a bitmap on an ActiveX
control placed on a client's dialog. This bitmap is a resource for the
client. In my desktop version, I was using the CPictureHolder class to
get the image into. However, this class is unsupported in WinCE.
Hence, I created a new property for this ActiveX of type OLE_HANDLE
with Get/Set methods.

DISP_PROPERTY_EX(CMFCActiveXCtrl, "BitmapHandle", GetBitmapHandle,
SetBitmapHandle, VT_HANDLE)

>From my client, I created a wrapper class for the ActiveX using the

class wizard and added the GetBitmapHandle, SetBitmapHandle methods.
Herel is the external implemation
OLE_HANDLE CMFCActiveX::GetBitmapHandle()
{
return NULL;
}

void CMFCActiveX::SetBitmapHandle(OLE_HANDLE nNewValue)
{
SetProperty(0x3, VT_HANDLE, nNewValue);
}

Now I add a variable to my Control ID for the ActiveX using:
DDX_Control(pDX, IDC_MFCACTIVEXCTRL3, m_ButtonActiveX);

I am assuming that I can set the bitmap handle using:
m_ButtonActiveX.SetBitmapHandle((OLE_HANDLE) hBmp) where hBmp is the
handle to the image that I just loaded using LoadImage.

My question is, now how do I get this bitmap handle in my ActiveX
control so I can display it on my ActiveX control DC? In other words,
what should the implementation on GetBitmapHandle look like inside the
ActiveX control?
Please let me know if my question is unclear. I would sincerely
appreciate any ideas as I am sure there is a way to do this in Windows
CE without using the CPictureHolder class.
Thanks,

Vivek Kinra
Project Engineer

Voidcoder

2006-01-31, 8:00 am

Hm, not clear where the problem is. As far as you can pass
bitmap handle to control through SetProperty, why not possible to
receive it back via GetProperty?



<vkinra@hotmail.com> wrote in message news:1138658259.956997.286980@g44g2000cwa.googlegroups.com...
> Hi,
>
> Basically, I want to create an ActiveX control button that displays
> different images in different states (up, down, etc). I want to be able
> to select the images by entering their name in the ActiveX's property
> from its container after I insert it into the dialog.
> I am running into a brick wall trying to place a bitmap on an ActiveX
> control placed on a client's dialog. This bitmap is a resource for the
> client. In my desktop version, I was using the CPictureHolder class to
> get the image into. However, this class is unsupported in WinCE.
> Hence, I created a new property for this ActiveX of type OLE_HANDLE
> with Get/Set methods.
>
> DISP_PROPERTY_EX(CMFCActiveXCtrl, "BitmapHandle", GetBitmapHandle,
> SetBitmapHandle, VT_HANDLE)
>
> class wizard and added the GetBitmapHandle, SetBitmapHandle methods.
> Herel is the external implemation
> OLE_HANDLE CMFCActiveX::GetBitmapHandle()
> {
> return NULL;
> }
>
> void CMFCActiveX::SetBitmapHandle(OLE_HANDLE nNewValue)
> {
> SetProperty(0x3, VT_HANDLE, nNewValue);
> }
>
> Now I add a variable to my Control ID for the ActiveX using:
> DDX_Control(pDX, IDC_MFCACTIVEXCTRL3, m_ButtonActiveX);
>
> I am assuming that I can set the bitmap handle using:
> m_ButtonActiveX.SetBitmapHandle((OLE_HANDLE) hBmp) where hBmp is the
> handle to the image that I just loaded using LoadImage.
>
> My question is, now how do I get this bitmap handle in my ActiveX
> control so I can display it on my ActiveX control DC? In other words,
> what should the implementation on GetBitmapHandle look like inside the
> ActiveX control?
> Please let me know if my question is unclear. I would sincerely
> appreciate any ideas as I am sure there is a way to do this in Windows
> CE without using the CPictureHolder class.
> Thanks,
>
> Vivek Kinra
> Project Engineer
>



Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2009 codecomments.com