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.

Syntax

class COleException : public CException  

Members

Public Methods

Name Description
COleException::Process Translates a caught exception into an OLE return code.

Public Data Members

Name Description
COleException::m_sc Contains the status code that indicates the reason for the exception.

Remarks

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.

Inheritance Hierarchy

CObject

CException

COleException

Requirements

Header: afxdisp.h

COleException::m_sc

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();
   }

COleException::Process

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

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.

See Also

MFC Sample CALCDRIV
CException Class
Hierarchy Chart