From: http://hi.baidu.com/vc_net/item/a6357e0e6d5437f3a1103447
Incorrect assertions,
Find the code (this version is vs2010, and each version will be different. It may not be in line 329th, but it all means this), as shown below:
Bool cwnd: showwindow (INT ncmdshow)
{
Assert (: iswindow (m_hwnd) | (m_pctrlsite! = NULL); // This is the 329 line of vs2010. The error is returned here.
If (m_pctrlsite = NULL)
Return: showwindow (m_hwnd, ncmdshow );
Else
Return m_pctrlsite-> showwindow (ncmdshow );
}
Error Cause Analysis:
Find out the cause of the Error. Let's take a look at how the code is written. How can this happen?
Void ckgdlg: onbnclickedstatusbtn ()
{
If (home_stata _)
{
M_html_home.movewindow (33,107,660,466 );
M_html_home.showwindow (sw_show );
//: Movewindow (m_html_home.m_hwnd, 33,107,660,466, 1 );
//: Showwindow (m_html_home.m_hwnd, sw_show );
Home_stata _ = false;
}
Else
{
M_html_home.movewindow (33,107,660, 66 );
M_html_home.showwindow (sw_hide );
//: Movewindow (m_html_home.m_hwnd, 33,107,660 );
//: Showwindow (m_html_home.m_hwnd, sw_hide );
Home_stata _ = true;
}
}
Solution:
Void ckgdlg: onbnclickedstatusbtn ()
{
If (home_stata _)
{
// M_html_home.movewindow (33,107,660,466 );
// M_html_home.showwindow (sw_show );
: Movewindow (m_html_home.m_hwnd, 33,107,660,466, 1 );
: Showwindow (m_html_home.m_hwnd, sw_show );
Home_stata _ = false;
}
Else
{
// M_html_home.movewindow (33,107,660, 66 );
// M_html_home.showwindow (sw_hide );
: Movewindow (m_html_home.m_hwnd, 33,107,660, 66,1 );
: Showwindow (m_html_home.m_hwnd, sw_hide );
Home_stata _ = true;
}
}
Why? It is because MFC is used,
Why? Because the API is used.
The real reason is that the handle passed in by the API is the handle of the control, that is, the control-> m_hwnd, And the handle passed in by MFC is the handle of this class (that is, ckgdlg class, that is, this-> m_hwnd.
Another thing to note is that the release version may run normally sometimes, so you are lucky to use it. In fact, both the release version and the debug version must be handled in the above way, if you want to control a control, you can upload the corresponding handle.
Assertion reference: http://hi.baidu.com/vc_net/item/82e10f0c4a1e776dd55a113f
Thanks to the original creators...