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. Assert Modal Dialog wincore.cpp

Assert Modal Dialog wincore.cpp

Scheduled Pinned Locked Moved C / C++ / MFC
c++comdebugginghelpquestion
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.
  • Z Offline
    Z Offline
    zqueezy
    wrote on last edited by
    #1

    hey folks, i stumbled across an assertion in my program. When I want to show a dialog modally the dialog is shown correctly, but when I close the dialog I get an assert: "Debug assertion failed! ... program ...wincore.cpp line 882" which is:

    void CWnd::AssertValid() const
    {
    if (m_hWnd == NULL)
    return; // null (unattached) windows are valid

    // check for special wnd??? values
    ASSERT(HWND\_TOP == NULL);       // same as desktop
    if (m\_hWnd == HWND\_BOTTOM)
    	ASSERT(this == &CWnd::wndBottom);
    else if (m\_hWnd == HWND\_TOPMOST)
    	ASSERT(this == &CWnd::wndTopMost);
    else if (m\_hWnd == HWND\_NOTOPMOST)
    	ASSERT(this == &CWnd::wndNoTopMost);
    else
    {
    	// should be a normal window
    	ASSERT(::IsWindow(m\_hWnd));    //<-- HERE
    

    My code is farely simple:

    CSelectionDlg dlg;
    dlg.DoModal();

    the thing is: I call this from a member-class:

    -MyDialogDlg my dialog
    -SomeClass m_instanceOfClass; a memberclass of dialog.
    a function of Someclass does the above code

    I found some stuff from microsoft: http://support.microsoft.com/kb/194300/eng which didn't work for my case! if I add

    ASSERT(::IsWindow(m_hWnd));

    before the domodal nothing changes... so somehow my handle gets lost and I donnu what to do. can anybody help? maybe a simple link. i tried many links, although nothing worked for my case. I don't have any crazy stuff in my OnInit of the dialog nor do I have another dialog as model dialog thx for your help zqueezy

    H 1 Reply Last reply
    0
    • Z zqueezy

      hey folks, i stumbled across an assertion in my program. When I want to show a dialog modally the dialog is shown correctly, but when I close the dialog I get an assert: "Debug assertion failed! ... program ...wincore.cpp line 882" which is:

      void CWnd::AssertValid() const
      {
      if (m_hWnd == NULL)
      return; // null (unattached) windows are valid

      // check for special wnd??? values
      ASSERT(HWND\_TOP == NULL);       // same as desktop
      if (m\_hWnd == HWND\_BOTTOM)
      	ASSERT(this == &CWnd::wndBottom);
      else if (m\_hWnd == HWND\_TOPMOST)
      	ASSERT(this == &CWnd::wndTopMost);
      else if (m\_hWnd == HWND\_NOTOPMOST)
      	ASSERT(this == &CWnd::wndNoTopMost);
      else
      {
      	// should be a normal window
      	ASSERT(::IsWindow(m\_hWnd));    //<-- HERE
      

      My code is farely simple:

      CSelectionDlg dlg;
      dlg.DoModal();

      the thing is: I call this from a member-class:

      -MyDialogDlg my dialog
      -SomeClass m_instanceOfClass; a memberclass of dialog.
      a function of Someclass does the above code

      I found some stuff from microsoft: http://support.microsoft.com/kb/194300/eng which didn't work for my case! if I add

      ASSERT(::IsWindow(m_hWnd));

      before the domodal nothing changes... so somehow my handle gets lost and I donnu what to do. can anybody help? maybe a simple link. i tried many links, although nothing worked for my case. I don't have any crazy stuff in my OnInit of the dialog nor do I have another dialog as model dialog thx for your help zqueezy

      H Offline
      H Offline
      Hamid Taebi
      wrote on last edited by
      #2

      Did you try to trace your code line to line it seems you have a unvalid hwnd on your code.

      Z 1 Reply Last reply
      0
      • H Hamid Taebi

        Did you try to trace your code line to line it seems you have a unvalid hwnd on your code.

        Z Offline
        Z Offline
        zqueezy
        wrote on last edited by
        #3

        well, as I said, the handle is valid before the DoModal-call! but somehow not during it

        R 1 Reply Last reply
        0
        • Z zqueezy

          well, as I said, the handle is valid before the DoModal-call! but somehow not during it

          R Offline
          R Offline
          Roger Broomfield
          wrote on last edited by
          #4

          I would expect your ASSERT placed before the DoModal() to succeed, it just means that you are calling DoModal() from a CWnd derived class that has a valid Window, it has no bearing on the state of the dialog. Are you calling DestroyWindow() somewhere in your Dialog class?

          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