Article ID: 181207
Article Last Modified on 11/21/2006
try
{
// Execute some code that might throw an exception.
}
catch( CInternetException* e )
{
// Handle the Internet exception here.
}
catch( CException* e )
{
// Handle all other types of exceptions here.
}
If for some reason it is still necessary to obtain the run-time class
information for a class that may be CinternetException, it is possible to
use the Run-Time Type Information (RTTI) provided by Visual C++. To use
RTTI, the Run-Time Type Information must be enabled in the C++ Language
settings for the project. Then, the dynamic_cast operator can be used to
attempt a conversion of the exception to CInternetException. If the cast
fails, the exception is of another type. It is also possible to obtain the
Run-Time Type Information directly as follows:
const type_info& info = typeid(*e);
CRuntimeClass* prt; prt = RUNTIME_CLASS( CInternetException );Looking at prt in the debugger shows that the CRuntimeClass structure is empty. This behavior is not observed in projects that are statically linked to MFC.
Additional query words: RTTI
Keywords: kbbug kbcode kbfix kbvc600fix KB181207