COleException Class

 

The new home for Visual Studio documentation is Visual Studio 2017 Documentation on docs.microsoft.com.

The latest version of this topic can be found at COleException Class.

Represents an exception condition related to an OLE operation.

class COleException : public CException  

Public Methods

NameDescription
COleException::ProcessTranslates a caught exception into an OLE return code.

Public Data Members

NameDescription
COleException::m_scContains the status code that indicates the reason for the exception.

The COleException class includes a public data member that holds the status code indicating the reason for the exception.

In general, you should not create a COleException object directly; instead, you should call [AfxThrowOleException]--brokenlink--(../Topic/not%20found.md#afxthrowoleexception).

For more information on exceptions, see the articles Exception Handling (MFC) and Exceptions: OLE Exceptions.

CObject

CException

COleException

Header: afxdisp.h

This data member holds the OLE status code that indicates the reason for the exception.

SCODE m_sc;  

Remarks

This variable's value is set by [AfxThrowOleException]--brokenlink--(../Topic/not%20found.md#afxthrowoleexception).

For more information on SCODE, see Structure of COM Error Codes in the Windows SDK.

Example

   try 
   {
      SomeOleFunc();
   }
   catch (COleException* pe) 
   {
      TRACE (_T("COleException caught. SCODE = %x\n"), pe->m_sc);
      pe->Delete();
   }

Call the Process member function to translate a caught exception into an OLE status code.

static SCODE PASCAL Process(const CException* pAnyException);

Parameters

pAnyException
Pointer to a caught exception.

Return Value

An OLE status code.

Remarks

System_CAPS_ICON_note.jpg Note

This function is static.

For more information on SCODE, see Structure of COM Error Codes in the Windows SDK.

Example

See the example for COleDispatchDriver::CreateDispatch.

MFC Sample CALCDRIV
CException Class
Hierarchy Chart

Show: