CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 5 of 5
  1. #1
    Join Date
    May 2009
    Posts
    8

    AssertValid() error

    Hi

    When I released my left-mouse button, I always get following assertion errors in the following functions.

    I found out that "m_hMenuShared" is not NULL. What kind problem will cause this?

    void CMDIChildWnd::AssertValid() const
    {
    CFrameWnd::AssertValid();
    ASSERT(m_hMenuShared == NULL || ::IsMenu(m_hMenuShared));
    }



    After I made following changes, the above errors show.



    Changed From:
    BOOL CSplitFrame::OnCreateClient(LPCREATESTRUCT lpcs, CCreateContext* pContext)
    {
    return m_wndSplitter.Create( this,
    2, 2, // TODO: adjust the number of rows, columns
    CSize( 10, 10 ), // TODO: adjust the minimum pane size
    pContext );

    }

    To:
    BOOL CSplitFrame::OnCreateClient(LPCREATESTRUCT lpcs, CCreateContext* pContext)
    {
    return CMDIChildWnd::OnCreateClient(lpcs, pContext);
    }

  2. #2
    Join Date
    Jul 2002
    Posts
    2,543

    Re: AssertValid() error

    From MSDN topic CFrameWnd::OnCreateClient:
    Never call this function.

    If you don't have any actions for OnCreateClient, don't override this function.

  3. #3
    Join Date
    Feb 2005
    Posts
    2,160

    Re: AssertValid() error

    From MSDN here, a contradiction:

    http://msdn.microsoft.com/en-us/libr...8VS.80%29.aspx

    Edit: Whoops. I missed the part where he deleted everything in the override. My bad.

  4. #4
    Join Date
    Mar 2003
    Location
    India {Mumbai};
    Posts
    3,871

    Re: AssertValid() error

    void CMDIChildWnd::AssertValid() const
    When your code asserts at this function, look at the call stack, find from where it is coming. Find the last "user-defined" function called.
    My latest article: Explicating the new C++ standard (C++0x)

    Do rate the posts you find useful.

  5. #5
    Join Date
    May 2009
    Posts
    8

    Re: AssertValid() error

    I think the problem is from the menu handling.

    I did a dynamic menu assignment while the program startup. I think I messed up somthing.

    Thanks,

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured