FIX: CRuntimeClass Not Available for CInternetException (181207)
The information in this article applies to:
- The Microsoft Foundation Classes (MFC), when used with:
- Microsoft Visual C++, 32-bit Enterprise Edition 5.0
- Microsoft Visual C++, 32-bit Professional Edition 5.0
This article was previously published under Q181207 SYMPTOMS
Attempting to obtain run-time class information for CInternetException by
using the RUNTIME_CLASS macro fails. The CRuntimeClass structure returned
for CInternetException is empty.
RESOLUTION
C++ exception handling can determine the type of exception thrown. A
typical handler has a format similar to the following:
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);
STATUS
Microsoft has confirmed this to be a bug in the Microsoft products listed
at the beginning of this article. This problem was corrected in Visual C++
version 6.0.
Modification Type: | Major | Last Reviewed: | 11/18/2003 |
---|
Keywords: | kbBug kbcode kbfix kbVC600fix KB181207 |
---|
|