Loading ...
Sorry, an error occurred while loading the content.
 

Re: Adding Message Handling to Base Class Not Derived From ATL Class

Expand Messages
  • Ken Wilson
    I tried both of these approaches and have run into a new issue. Because the CDisplayManager class contains two instances of the CBrowserDisplay class both
    Message 1 of 11 , Jun 29, 2007
      I tried both of these approaches and have run into a new issue.
      Because the CDisplayManager class contains two instances of the
      CBrowserDisplay class both classes rely on each others headers. I
      seem to have a chicken and the egg relationship here and I am
      generating far more compiler errors than before.

      Might it be a better approach to derive CDisplayManager from
      CBrowserDisplay than use the current, apparently flawed, approach of
      having the CDisplayManager act as a container?

      --- In wtl@yahoogroups.com, "Jiyong Xu" <xujiyong@...> wrote:
      >
      > method 1:
      >
      > class CDisplayManager : public CMessageMap{
      >
      > }
      >
      > class CBrowserDisplay : public CAxDialogImpl<CBrowserDisplay>,
      > CDisplayManager{
      >
      > public:
      > CHAIN_MSG_MAP(CDisplayManager)
      >
      > }
      >
      > method 2:
      >
      > class CDisplayManager : public CMessageMap{
      >
      > }
      >
      > class CBrowserDisplay : public CAxDialogImpl<CBrowserDisplay>{
      >
      > public:
      > CHAIN_MSG_MAP_MEMBER(m_displayManager)
      >
      > CDisplayManager m_displayManager;
      > }
      >
      >
      >
      >
      > *With best wishes,
      > Bruce Xu*
    • Ken Wilson
      First of all, thanks to Igor and Bruce for their patience with a newbie. Secondly, this has been resolved and I feel I should share the solution both for
      Message 2 of 11 , Jul 6, 2007
        First of all, thanks to Igor and Bruce for their patience with a
        newbie. Secondly, this has been resolved and I feel I should share the
        solution both for completeness and for critique.

        My final solution was to derive from CDynamicChain for both classes and
        have the CDisplayManager object pass it's chain ID and this pointer as
        parameters in the CBrowserDisplay constructor. Besides resolving my
        earlier issues, I hope this leads to looser coupling, making the
        CBrowserDisplay class more reusable.

        Once again, thank you to everyone for their time and patience.
      Your message has been successfully submitted and would be delivered to recipients shortly.