Is there any great secret to getting 'OnDraw' to be called in a
Composite Control?
thanks in advance...
-BB
"For every complex problem, there is a solution that is simple, neat,
and wrong." H.L. Mencken
"Brian Burgess" <bburg...@hotmail.com> wrote in message
news:amj21vs53egi874b0...@4ax.com...
Any other ideas?
thanks
-BB
Do you, by any chance, have an entry for WM_PAINT in the message map?
OnDraw is called (among other places) from WM_PAINT handler in
CComControl class. If you intercept the message before it gets to
CHAIN_MSG_MAP, you won't get OnDraw.
Show the complete declaration of your class.
--
With best wishes,
Igor Tandetnik
"For every complex problem, there is a solution that is simple, neat,
and wrong." H.L. Mencken
"Brian Burgess" <bburg...@hotmail.com> wrote in message
news:mo851v0thusflf1kf...@4ax.com...
> Yes the CHAIN_MSG_MAP is in there .. but it was at the top of the
> map..
> My OnDraw looks like this:
> HRESULT OnDraw(ATL_DRAWINFO& di);
>
at any rate, here is the complete class declaration:
******************************************************************
// FormDlg.h : Declaration of the CFormDlg
#ifndef __FORMDLG_H_
#define __FORMDLG_H_
#include "resource.h" // main symbols
#include <atlctl.h>
/////////////////////////////////////////////////////////////////////////////
// CFormDlg
class ATL_NO_VTABLE CFormDlg :
public CComObjectRootEx<CComSingleThreadModel>,
public CStockPropImpl<CFormDlg, IFormDlg, &IID_IFormDlg,
&LIBID_FORMFILLERCTRLLib>,
public CComCompositeControl<CFormDlg>,
public IPersistStreamInitImpl<CFormDlg>,
public IOleControlImpl<CFormDlg>,
public IOleObjectImpl<CFormDlg>,
public IOleInPlaceActiveObjectImpl<CFormDlg>,
public IViewObjectExImpl<CFormDlg>,
public IOleInPlaceObjectWindowlessImpl<CFormDlg>,
public IConnectionPointContainerImpl<CFormDlg>,
public IPersistStorageImpl<CFormDlg>,
public ISpecifyPropertyPagesImpl<CFormDlg>,
public IQuickActivateImpl<CFormDlg>,
public IDataObjectImpl<CFormDlg>,
public IProvideClassInfo2Impl<&CLSID_FormDlg,
&DIID__IFormDlgEvents, &LIBID_FORMFILLERCTRLLib>,
public IPropertyNotifySinkCP<CFormDlg>,
public CComCoClass<CFormDlg, &CLSID_FormDlg>
{
public:
CFormDlg();
~CFormDlg();
DECLARE_REGISTRY_RESOURCEID(IDR_FORMDLG)
DECLARE_PROTECT_FINAL_CONSTRUCT()
BEGIN_COM_MAP(CFormDlg)
COM_INTERFACE_ENTRY(IFormDlg)
COM_INTERFACE_ENTRY(IDispatch)
COM_INTERFACE_ENTRY(IViewObjectEx)
COM_INTERFACE_ENTRY(IViewObject2)
COM_INTERFACE_ENTRY(IViewObject)
COM_INTERFACE_ENTRY(IOleInPlaceObjectWindowless)
COM_INTERFACE_ENTRY(IOleInPlaceObject)
COM_INTERFACE_ENTRY2(IOleWindow, IOleInPlaceObjectWindowless)
COM_INTERFACE_ENTRY(IOleInPlaceActiveObject)
COM_INTERFACE_ENTRY(IOleControl)
COM_INTERFACE_ENTRY(IOleObject)
COM_INTERFACE_ENTRY(IPersistStreamInit)
COM_INTERFACE_ENTRY2(IPersist, IPersistStreamInit)
COM_INTERFACE_ENTRY(IConnectionPointContainer)
COM_INTERFACE_ENTRY(ISpecifyPropertyPages)
COM_INTERFACE_ENTRY(IQuickActivate)
COM_INTERFACE_ENTRY(IPersistStorage)
COM_INTERFACE_ENTRY(IDataObject)
COM_INTERFACE_ENTRY(IProvideClassInfo)
COM_INTERFACE_ENTRY(IProvideClassInfo2)
END_COM_MAP()
BEGIN_PROP_MAP(CFormDlg)
PROP_DATA_ENTRY("_cx", m_sizeExtent.cx, VT_UI4)
PROP_DATA_ENTRY("_cy", m_sizeExtent.cy, VT_UI4)
PROP_ENTRY("Appearance", DISPID_APPEARANCE, CLSID_NULL)
PROP_ENTRY("AutoSize", DISPID_AUTOSIZE, CLSID_NULL)
PROP_ENTRY("BackColor", DISPID_BACKCOLOR,
CLSID_StockColorPage)
PROP_ENTRY("BackStyle", DISPID_BACKSTYLE, CLSID_NULL)
PROP_ENTRY("BorderColor", DISPID_BORDERCOLOR,
CLSID_StockColorPage)
PROP_ENTRY("BorderStyle", DISPID_BORDERSTYLE, CLSID_NULL)
PROP_ENTRY("BorderVisible", DISPID_BORDERVISIBLE, CLSID_NULL)
PROP_ENTRY("BorderWidth", DISPID_BORDERWIDTH, CLSID_NULL)
PROP_ENTRY("Caption", DISPID_CAPTION, CLSID_NULL)
PROP_ENTRY("Enabled", DISPID_ENABLED, CLSID_NULL)
PROP_ENTRY("FillColor", DISPID_FILLCOLOR,
CLSID_StockColorPage)
PROP_ENTRY("FillStyle", DISPID_FILLSTYLE, CLSID_NULL)
PROP_ENTRY("ForeColor", DISPID_FORECOLOR,
CLSID_StockColorPage)
PROP_ENTRY("Picture", DISPID_PICTURE, CLSID_StockPicturePage)
PROP_ENTRY("TabStop", DISPID_TABSTOP, CLSID_NULL)
PROP_ENTRY("Text", DISPID_TEXT, CLSID_NULL)
PROP_ENTRY("Valid", DISPID_VALID, CLSID_NULL)
// Example entries
// PROP_ENTRY("Property Description", dispid, clsid)
// PROP_PAGE(CLSID_StockColorPage)
END_PROP_MAP()
BEGIN_CONNECTION_POINT_MAP(CFormDlg)
CONNECTION_POINT_ENTRY(IID_IPropertyNotifySink)
END_CONNECTION_POINT_MAP()
BEGIN_MSG_MAP(CFormDlg)
MESSAGE_HANDLER(WM_LBUTTONDOWN, OnLButtonDown)
MESSAGE_HANDLER(WM_LBUTTONUP, OnLButtonUP)
MESSAGE_HANDLER(WM_INITDIALOG, OnInitDialog)
MESSAGE_HANDLER(WM_CREATE, OnCreate)
CHAIN_MSG_MAP(CComCompositeControl<CFormDlg>)
END_MSG_MAP()
// Handler prototypes:
// LRESULT MessageHandler(UINT uMsg, WPARAM wParam, LPARAM lParam,
BOOL& bHandled);
// LRESULT CommandHandler(WORD wNotifyCode, WORD wID, HWND hWndCtl,
BOOL& bHandled);
// LRESULT NotifyHandler(int idCtrl, LPNMHDR pnmh, BOOL& bHandled);
BEGIN_SINK_MAP(CFormDlg)
//Make sure the Event Handlers have __stdcall calling
convention
///SINK_ENTRY(IDC_FormImage, DISPID_MOUSEDOWN,
OnMouseDownImageCtrl)
///SINK_ENTRY(IDC_FormImage, DISPID_MOUSEUP,
OnMouseUpFormImageCtrl)
END_SINK_MAP()
STDMETHOD(OnAmbientPropertyChange)(DISPID dispid)
{
if (dispid == DISPID_AMBIENT_BACKCOLOR)
{
SetBackgroundColorFromAmbient();
FireViewChange();
}
return
IOleControlImpl<CFormDlg>::OnAmbientPropertyChange(dispid);
}
// IViewObjectEx
DECLARE_VIEW_STATUS(1)
// IFormDlg
public:
HRESULT OnDraw(ATL_DRAWINFO &di);
LRESULT OnInitDialog(UINT uMsg, WPARAM wParam, LPARAM lParam,
BOOL& bHandled);
LRESULT CFormDlg::OnLButtonDown(UINT uMsg, WPARAM wParam,
LPARAM lParam, BOOL& bHandled);
LRESULT CFormDlg::OnLButtonUP(UINT uMsg, WPARAM wParam, LPARAM
lParam, BOOL& bHandled);
short m_nAppearance;
OLE_COLOR m_clrBackColor;
LONG m_nBackStyle;
OLE_COLOR m_clrBorderColor;
LONG m_nBorderStyle;
BOOL m_bBorderVisible;
LONG m_nBorderWidth;
CComBSTR m_bstrCaption;
BOOL m_bEnabled;
HWND m_hHWND;
OLE_COLOR m_clrFillColor;
LONG m_nFillStyle;
CComPtr<IFontDisp> m_pFont;
OLE_COLOR m_clrForeColor;
CComPtr<IPictureDisp> m_pPicture;
BOOL m_bTabStop;
CComBSTR m_bstrText;
BOOL m_bValid;
enum { IDD = IDD_FORMDLG };
private:
LRESULT OnCreate(UINT uMsg, WPARAM wParam,
LPARAM lParam, BOOL& bHandled);
};
#endif //__FORMDLG_H_
******************************************************************
typedef CComControl<CMyCtl, CAxDialogImpl<CMyCtl> > comControlBase;
BEGIN_MSG_MAP(CMyCtl)
// Add your regular message handlers here
CHAIN_MSG_MAP(CComCompositeControl<CMyCtl>)
CHAIN_MSG_MAP(comControlBase)
END_MSG_MAP()
--
With best wishes,
Igor Tandetnik
"For every complex problem, there is a solution that is simple, neat,
and wrong." H.L. Mencken
"Brian Burgess" <bburg...@hotmail.com> wrote in message
news:ket91v4qr96hmdjm8...@4ax.com...
-BB