-
October 5th, 2009, 07:52 AM
#1
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);
}
-
October 5th, 2009, 08:17 AM
#2
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.
-
October 5th, 2009, 08:35 AM
#3
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.
-
October 5th, 2009, 10:51 AM
#4
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.
-
October 5th, 2009, 11:49 AM
#5
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|