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. C / C++ / MFC
  4. Subclassed Control

Subclassed Control

Scheduled Pinned Locked Moved C / C++ / MFC
c++comhelpquestion
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.
  • H Offline
    H Offline
    Hesham Amin
    wrote on last edited by
    #1

    hi.. I create a subclassed MFC ActiveX control .. Subclassed from the Listbox control .. a have a method that should add an item : the code causes an assertion .. can anyone help ? void CSubCtrl::AddItem(BSTR FAR* strItem) { CString st(*strItem); //AfxMessageBox(st); CListBox lb; lb.Attach(COleControl::m_hWnd); lb.AddString(st); lb.Detach(); }

    M 1 Reply Last reply
    0
    • H Hesham Amin

      hi.. I create a subclassed MFC ActiveX control .. Subclassed from the Listbox control .. a have a method that should add an item : the code causes an assertion .. can anyone help ? void CSubCtrl::AddItem(BSTR FAR* strItem) { CString st(*strItem); //AfxMessageBox(st); CListBox lb; lb.Attach(COleControl::m_hWnd); lb.AddString(st); lb.Detach(); }

      M Offline
      M Offline
      MAAK
      wrote on last edited by
      #2

      When talking about assertion, it's needed to know what is its condition from the file it exists in. However, I guess that the possible assertion that could occur in your code is the IsWindow() assertion (ASSERT(::IsWindow(hWnd)) which indicate the the HWND passed to the Attach() function is invalid. When you get an assertion in debug mode, click retry to see the assertion condition.

      H 1 Reply Last reply
      0
      • M MAAK

        When talking about assertion, it's needed to know what is its condition from the file it exists in. However, I guess that the possible assertion that could occur in your code is the IsWindow() assertion (ASSERT(::IsWindow(hWnd)) which indicate the the HWND passed to the Attach() function is invalid. When you get an assertion in debug mode, click retry to see the assertion condition.

        H Offline
        H Offline
        Hesham Amin
        wrote on last edited by
        #3

        Hi.. the asseion occures in Attach method .. when i step in the code i find that ASSERT(FromHandlePermanent(hWndNew) == NULL); causes an assetion.. any suggestion please ?

        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