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. Assertion Error in ownerdraw combobox..

Assertion Error in ownerdraw combobox..

Scheduled Pinned Locked Moved C / C++ / MFC
help
4 Posts 3 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.
  • A Offline
    A Offline
    AbhiHcl
    wrote on last edited by
    #1

    Hi I am creating ownerdraw combobox, when I am calling create function in my CCstomCombox which is derived from CComboBox, its giving Assertion error. After debuging I got the error in below function: My Create function is : this->Create(WS_CHILD|WS_VISIBLE|WS_BORDER|WS_HSCROLL|WS_VSCROLL|CBS_HASSTRINGS |CBS_DROPDOWNLIST|CBS_OWNERDRAWFIXED,rect,pWnd,nID); In line : (ASSERT(pWnd->m_hWnd == NULL); // only do once) In function: void AFXAPI AfxHookWindowCreate(CWnd* pWnd) { _AFX_THREAD_STATE* pThreadState = _afxThreadState.GetData(); if (pThreadState->m_pWndInit == pWnd) return; if (pThreadState->m_hHookOldCbtFilter == NULL) { pThreadState->m_hHookOldCbtFilter = ::SetWindowsHookEx(WH_CBT, _AfxCbtFilterHook, NULL, ::GetCurrentThreadId()); if (pThreadState->m_hHookOldCbtFilter == NULL) AfxThrowMemoryException(); } ASSERT(pThreadState->m_hHookOldCbtFilter != NULL); ASSERT(pWnd != NULL); ASSERT(pWnd->m_hWnd == NULL); // only do once ASSERT(pThreadState->m_pWndInit == NULL); // hook not already in progress pThreadState->m_pWndInit = pWnd; } Please help me to come out from this. Thanks..

    K A 2 Replies Last reply
    0
    • A AbhiHcl

      Hi I am creating ownerdraw combobox, when I am calling create function in my CCstomCombox which is derived from CComboBox, its giving Assertion error. After debuging I got the error in below function: My Create function is : this->Create(WS_CHILD|WS_VISIBLE|WS_BORDER|WS_HSCROLL|WS_VSCROLL|CBS_HASSTRINGS |CBS_DROPDOWNLIST|CBS_OWNERDRAWFIXED,rect,pWnd,nID); In line : (ASSERT(pWnd->m_hWnd == NULL); // only do once) In function: void AFXAPI AfxHookWindowCreate(CWnd* pWnd) { _AFX_THREAD_STATE* pThreadState = _afxThreadState.GetData(); if (pThreadState->m_pWndInit == pWnd) return; if (pThreadState->m_hHookOldCbtFilter == NULL) { pThreadState->m_hHookOldCbtFilter = ::SetWindowsHookEx(WH_CBT, _AfxCbtFilterHook, NULL, ::GetCurrentThreadId()); if (pThreadState->m_hHookOldCbtFilter == NULL) AfxThrowMemoryException(); } ASSERT(pThreadState->m_hHookOldCbtFilter != NULL); ASSERT(pWnd != NULL); ASSERT(pWnd->m_hWnd == NULL); // only do once ASSERT(pThreadState->m_pWndInit == NULL); // hook not already in progress pThreadState->m_pWndInit = pWnd; } Please help me to come out from this. Thanks..

      K Offline
      K Offline
      KarstenK
      wrote on last edited by
      #2

      you are creating the box one more time. If it is from a rc file, you dont need to call the constructor.

      Press F1 for help or google it. Greetings from Germany

      A 1 Reply Last reply
      0
      • K KarstenK

        you are creating the box one more time. If it is from a rc file, you dont need to call the constructor.

        Press F1 for help or google it. Greetings from Germany

        A Offline
        A Offline
        AbhiHcl
        wrote on last edited by
        #3

        No man I m not creating any combobox using resource..

        1 Reply Last reply
        0
        • A AbhiHcl

          Hi I am creating ownerdraw combobox, when I am calling create function in my CCstomCombox which is derived from CComboBox, its giving Assertion error. After debuging I got the error in below function: My Create function is : this->Create(WS_CHILD|WS_VISIBLE|WS_BORDER|WS_HSCROLL|WS_VSCROLL|CBS_HASSTRINGS |CBS_DROPDOWNLIST|CBS_OWNERDRAWFIXED,rect,pWnd,nID); In line : (ASSERT(pWnd->m_hWnd == NULL); // only do once) In function: void AFXAPI AfxHookWindowCreate(CWnd* pWnd) { _AFX_THREAD_STATE* pThreadState = _afxThreadState.GetData(); if (pThreadState->m_pWndInit == pWnd) return; if (pThreadState->m_hHookOldCbtFilter == NULL) { pThreadState->m_hHookOldCbtFilter = ::SetWindowsHookEx(WH_CBT, _AfxCbtFilterHook, NULL, ::GetCurrentThreadId()); if (pThreadState->m_hHookOldCbtFilter == NULL) AfxThrowMemoryException(); } ASSERT(pThreadState->m_hHookOldCbtFilter != NULL); ASSERT(pWnd != NULL); ASSERT(pWnd->m_hWnd == NULL); // only do once ASSERT(pThreadState->m_pWndInit == NULL); // hook not already in progress pThreadState->m_pWndInit = pWnd; } Please help me to come out from this. Thanks..

          A Offline
          A Offline
          Aescleal
          wrote on last edited by
          #4

          When you use a control in a dialogue box AND describe it in the resource template you don't create it. You only use CWnd::Create (or overidden version) when you're creating the control outside of a dialogue box. So if you're using a dialogue box instead of calling Create set up the resource template and subclass the control using DDX_Control in DoDataExchange. Cheers, Ash PS: Just seen you response to Karsten, ignore this reply except for reference! PPS: It looks like you've already created the window when you called create. You're not calling it twice by mistake by any chance?

          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