CImageList in a ATL Property page 
Author Message
 CImageList in a ATL Property page

Hi All,

I working on creating my own property pages for a 3rd
party ActiveX object and I'm having some problems with
custom controls on the property page.  First off I'm
having problems creating a CImageList and having it load a
bitmap from the resources.  I found the following work
around but it there a better and easier way of doing this.

CBitmap* pBM = CBitmap::FromHandle(::LoadBitmap
(_Module.GetModuleInstance(), MAKEINTRESOURCE
(IDB_BITMAP_STACKED)));

// m_imlSmall is my CImageList
m_imlSmall.Create(16,16,ILC_COLOR16, 0,4);
m_imlSmall.Add(pBM, RGB(255,0,255));

The other problem I'm having is with SubclassDlgItem.  It
doesn't seem to quite work.  I can subclass an item but
some of the messages don't seem to be routed to the
subclass.  I end up having to catch the message in the
property page and then calling the subclass's function
directly.  For example I try to subclass a CComboBox.  I
set for owner draw but the subclass DrawItem never gets
called.  I end up catching the message with a OnDrawItem
and call the method directly.  Is that the way it has to
be done or is there a better way?  Thanks for all your
help.

-Ben



Tue, 14 Sep 2004 04:11:46 GMT  
 CImageList in a ATL Property page
Since you are using ATL it has no sense to combine it with MFC:). You can
use image list APIs. See for HIMAGELIST type.

Mike

Quote:
> Hi All,

> I working on creating my own property pages for a 3rd
> party ActiveX object and I'm having some problems with
> custom controls on the property page.  First off I'm
> having problems creating a CImageList and having it load a
> bitmap from the resources.  I found the following work
> around but it there a better and easier way of doing this.

> CBitmap* pBM = CBitmap::FromHandle(::LoadBitmap
> (_Module.GetModuleInstance(), MAKEINTRESOURCE
> (IDB_BITMAP_STACKED)));

> // m_imlSmall is my CImageList
> m_imlSmall.Create(16,16,ILC_COLOR16, 0,4);
> m_imlSmall.Add(pBM, RGB(255,0,255));

> The other problem I'm having is with SubclassDlgItem.  It
> doesn't seem to quite work.  I can subclass an item but
> some of the messages don't seem to be routed to the
> subclass.  I end up having to catch the message in the
> property page and then calling the subclass's function
> directly.  For example I try to subclass a CComboBox.  I
> set for owner draw but the subclass DrawItem never gets
> called.  I end up catching the message with a OnDrawItem
> and call the method directly.  Is that the way it has to
> be done or is there a better way?  Thanks for all your
> help.

> -Ben



Mon, 13 Sep 2004 16:39:52 GMT  
 CImageList in a ATL Property page

Quote:
> The other problem I'm having is with SubclassDlgItem.  It
> doesn't seem to quite work.  I can subclass an item but
> some of the messages don't seem to be routed to the
> subclass.  I end up having to catch the message in the
> property page and then calling the subclass's function
> directly.  For example I try to subclass a CComboBox.  I
> set for owner draw but the subclass DrawItem never gets
> called.  I end up catching the message with a OnDrawItem
> and call the method directly.  Is that the way it has to
> be done or is there a better way?  Thanks for all your
> help.

At the bottom of the message map of your property page, put
REFLECT_NOTIFICATIONS( ). In the message map of the class that
subclasses the control, handle OCM_DRAWITEM instead of WM_DRAWITEM
--
With best wishes,
    Igor Tandetnik

"For every complex problem, there is a solution that is simple, neat,
and wrong." H.L. Mencken



Tue, 14 Sep 2004 06:52:54 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. Property Sheet and Property pages in ATL

2. Property Pages in a Property Page

3. MFC property pages in ATL component

4. MFC CCheckListBox in ATL Property Page

5. ATL Property Pages.

6. Crash when invoking ATL control property page from Excel

7. Property Pages with ATL

8. how hide property page with ATL

9. how hide property page with ATL

10. How pass data to property page (ATL)

11. Hosting ActiveX Control in ATL property page

12. ATL Property pages

 

 
Powered by phpBB® Forum Software