VC 6.0 Summary of common assertion errors |
Assertion |
where function |
Specific location |
Significance |
ASSERT (m_hwnd==null) |
Cwnd::attach () |
Wincore. CPP file, in the line |
This assertion is usually due to an attempt to bundle a window that has been bundled with (attach) on other objects, with only one MFC objects can be tied to a window-otherwise, the message map will not work |
ASSERT ((dwstyle& ws_popup) = = 0) |
CWnd::Create () |
Wincore. the 747 line in the CPP file |
the cause is due to the use Create () function when trying to give Ws_popup style No, but not supported, want this style should use CreateEx () function |
ASSERT (PMap! = NULL) |
CWnd::D Estroywindow () |
Wincore. the 969 line in the CPP file |
The cause is the shutdown or destructor window when the message map is not activated. |
ASSERT (Cs.style & Ws_child) |
CWnd::P Recreatewindow () |
Wincore. the 733 line in the CPP file |
The reason is the use of Ws_child style, for No child window, preferably with CFrameWnd and don't use CWnd |
ASSERT (M_bitmap.m_hobject! = NULL) |
CBitmapButton::D Rawitem () |
winbtn. the 107 line in the CPP file |
The reason is that the bitmap was not loaded before the attempt to draw a bitmapped button caused a program error |
ASSERT (this = NULL) |
CObject::IsKindOf () |
Objcore. CPP file, , line |
once IsKindof () is an invalid by CWnd This assertion is generated when a derived object is called. It indicates that the object has not been initialized ( such as NULL pointer ) , or the memory has failed previously. |
ASSERT (!pdx->m_bsaveandvalidate) |
AFXAPI DDX_Control () |
Dlgdata. 624 Line of CPP file |
called UpdateData () or UpdateData (TRUE) must be called at least once before UpdateData (FALSE), Otherwise, this assertion will appear . |
ASSERT (FALSE) |
CDataExchange::P Reparectrl () |
Dlgdata. The first line of the CPP file |
The usual reason is to release a control associated with the data exchange variable |
ASSERT (:: GetWindowLong (Hwndctrl, Gwl_style) & Ws_group)
ASSERT (Value = =-1) |
AFXAPI Ddx_radio () |
Dlgdata. CPP files 308 and 325 |
This assertion is raised if the object being targeted by this call is not the first radio button in a group, or if any of the buttons in the group have been called more than once. Just the first button can have the ws_group window style. When using class wnzard , how do you want to associate a button other than the first button in the group with a member variable, the only way to set this button first Ws_group style, then associate the variable, and finally remove the Ws_group style. If you forget to remove ws_group, an assertion appears on . |
ASSERT (npagesave > 1) |
CEditView::P aginateto () |
Viewedit. CPP file 478 line |
usually starts with overloading the window's OnPrepareDC () function without first calling the base class OnPrepareDC () is caused, preferably in onprepareprinting () or onbeginprinting () set the number of pages to print |
ASSERT (FALSE) |
Afxapi afxmessagebox () |
APPUI1. CPP , 143 line |
the problem here may be caused by two different reasons : 1. string resource does not exist 2. not referencing resources correctly ( For example, wrong number , and so on ) |
ASSERT (m_hdc != NULL) |
CDC::SelectObject () |
There is a similar assertion for each type of Object (Pen,brush , etc. ) . |
not first called GetDC (), CreateDC () or Attach () The uses the object, which causes this assertion. This assertion essentially means that there is no device context . |
ASSERT (pobject == NULL | | pobject->m_hobject == h) |
CGdiObject:: FromHandle () |
WinGDI. CPP Section 1114 Line |
creates an object without releasing the previous object, which causes the assertion --- for example, the CreateFontIndirect () two times, but no call in the middle DeleteObject () |
ASSERT (m_hobject == NULL) |
< P align= "Center" > Cgdiobject::attach () |
WinGDI . CPP Section 1120 line |
This assertion is caused by the drawing object (Pen,brush Object ) selected device context but not selected [ with SelectObject () function ] |
ASSERT (sizetotal.cx >= 0 && sizetotal.cy >= 0) |
Cscrollview::setscrollsizes () |
viewscrl. The first line of CPP file |
most appear in use Cfromview and the CScrollView , the cause is not to initialize the scrolling dimension correctly, or to forget to pass the second argument |
in the Open the method is full of assertions |
Cstdiofile::open () |
Filetxt. CPP File |
These assertions capture no file names, or the file name does not have a NULL end of the situation |
ASSERT (M_hmenu = = NULL) |
Cmenu::attach () |
Winmenu. 98 line of CPP file |
This assertion failed because it was called two times. LoadMenu (), and there's no call in the middle DestroyMenu () |