Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Export (0) Print
Expand All
Expand Minimize


Use to test your assumptions about the validity of an object's internal state.



Specifies an object of a class derived from CObject that has an overriding version of the AssertValid member function.

ASSERT_VALID calls the AssertValid member function of the object passed as its argument.

In the Release version of MFC, ASSERT_VALID does nothing. In the Debug version, it validates the pointer, checks against NULL, and calls the object's own AssertValid member functions. If any of these tests fails, an alert message is displayed in the same manner as ASSERT.

Note Note

This function is available only in the Debug version of MFC.

For more information and examples, see Debugging MFC Applications.

// Assure that pMyObject is a valid pointer to an 
// object derived from CObject.

Header: afx.h

Community Additions

© 2015 Microsoft