Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. ATL / WTL / STL
  4. Using CContainedWindowT in a base class causes assert in conrete class

Using CContainedWindowT in a base class causes assert in conrete class

Scheduled Pinned Locked Moved ATL / WTL / STL
c++help
3 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • P Offline
    P Offline
    Philipp Kursawe
    wrote on last edited by
    #1

    I have a base template class

    template<class T, UINT titleId, int SortIndex, class WindowClass = ATL::CWindowImpl<T>>
    class ATL_NO_VTABLE ITabPageImpl : public WindowClass {

    BEGIN_MSG_MAP_EX(ITabPageImpl)
    MSG_WM_CREATE(onCreate)
    MSG_WM_DESTROY(onDestroy)

    REFLECT\_NOTIFICATIONS\_EX()
    

    ALT_MSG_MAP(1)
    NOTIFY_CODE_HANDLER_EX(LVN_DELETEITEM, onModifyTable)
    END_MSG_MAP()

    ITabPageImpl() : _table(this, 1) {}

    private:
    ATL::CContainedWindowTWTL::CListViewCtrl _table;

    In the onCreate method I subclass a control, if the implementation provides a specific method:

    __if_exists(T::getTableControl) {
    _table.SubclassWindow(static_cast<T*>(this)->getTableControl());
    }

    However, after subclassing the message loop of T produces an assertion when the subclassed control is supposed to process its first message. The basic Idea is, that I want to put handling of certain messages in the base class and lift the burden on implementation classes. Thanks for any help!

    Happy coding, Philipp Kursawe

    A 1 Reply Last reply
    0
    • P Philipp Kursawe

      I have a base template class

      template<class T, UINT titleId, int SortIndex, class WindowClass = ATL::CWindowImpl<T>>
      class ATL_NO_VTABLE ITabPageImpl : public WindowClass {

      BEGIN_MSG_MAP_EX(ITabPageImpl)
      MSG_WM_CREATE(onCreate)
      MSG_WM_DESTROY(onDestroy)

      REFLECT\_NOTIFICATIONS\_EX()
      

      ALT_MSG_MAP(1)
      NOTIFY_CODE_HANDLER_EX(LVN_DELETEITEM, onModifyTable)
      END_MSG_MAP()

      ITabPageImpl() : _table(this, 1) {}

      private:
      ATL::CContainedWindowTWTL::CListViewCtrl _table;

      In the onCreate method I subclass a control, if the implementation provides a specific method:

      __if_exists(T::getTableControl) {
      _table.SubclassWindow(static_cast<T*>(this)->getTableControl());
      }

      However, after subclassing the message loop of T produces an assertion when the subclassed control is supposed to process its first message. The basic Idea is, that I want to put handling of certain messages in the base class and lift the burden on implementation classes. Thanks for any help!

      Happy coding, Philipp Kursawe

      A Offline
      A Offline
      Alain Rist
      wrote on last edited by
      #2

      Hi Philipp, You are misunderstanding ATL::CContainedWindow operation. Post on the WTL support list[^] for help. cheers, AR

      When the wise (person) points at the moon the fool looks at the finger (Chinese proverb)

      P 1 Reply Last reply
      0
      • A Alain Rist

        Hi Philipp, You are misunderstanding ATL::CContainedWindow operation. Post on the WTL support list[^] for help. cheers, AR

        When the wise (person) points at the moon the fool looks at the finger (Chinese proverb)

        P Offline
        P Offline
        Philipp Kursawe
        wrote on last edited by
        #3

        Thanks Alain for your reply! Maybe I should describe what I want to achieve: I want to subclass a child window and pre-handle certain messages in my class before the child window can process them itself. I thought CContainedWindow was the way to go then? In the particular case I want to set the background colour of the window.

        Happy coding, Philipp Kursawe

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups