Skip to content

Latest commit

 

History

History
125 lines (82 loc) · 4.11 KB

platform-comexception-class.md

File metadata and controls

125 lines (82 loc) · 4.11 KB
titledescriptionms.datems.topicf1_keywordshelpviewer_keywords
Platform::COMException Class
Learn more about: Platform::COMException Class
12/30/2016
reference
VCCORLIB/Platform::COMException
VCCORLIB/Platform::COMException::HResult
VCCORLIB/Platform::COMException::Message
Platform::COMException Class

Platform::COMException Class

Represents COM errors that occur during application execution. COMException is the base class for a set of predefined, standard exceptions.

Syntax

public ref classCOMException : Exception, IException, IPrintable, IEquatable

Members

The COMException class inherits from the Object class and the IException, IPrintable, and IEquatable interfaces.

COMException also has the following types of members.

Constructors

MemberDescription
COMExceptionInitializes a new instance of the COMException class.

Methods

The COMException class inherits the Equals(), Finalize(), GetHashCode(), GetType(), MemberwiseClose(), and ToString() methods from the Platform::Object Class.

Properties

The COMException class has the following properties.

MemberDescription
Exception::HResultThe HRESULT that corresponds to the exception.
Exception::MessageMessage that describes the exception.

Derived Exceptions

The following predefined exceptions are derived from COMException. They differ from COMException only in their name, the name of their constructor, and their underlying HRESULT value.

NameUnderlying HRESULTDescription
COMExceptionuser-defined hresultThrown when an unrecognized HRESULT is returned from a COM method call.
AccessDeniedExceptionE_ACCESSDENIEDThrown when access is denied to a resource or feature.
ChangedStateExceptionE_CHANGED_STATEThrown when methods of a collection iterator or a collection view are called after the parent collection has changed, invalidating the results of the method.
ClassNotRegisteredExceptionREGDB_E_CLASSNOTREGThrown when a COM class has not been registered.
DisconnectedExceptionRPC_E_DISCONNECTEDThrown when an object is disconnected from its clients.
FailureExceptionE_FAILThrown when an operation fails.
InvalidArgumentExceptionE_INVALIDARGThrown when one of the arguments provided to a method is not valid.
InvalidCastExceptionE_NOINTERFACEThrown when a type can't be cast to another type.
NotImplementedExceptionE_NOTIMPLThrown if an interface method hasn't been implemented on a class.
NullReferenceExceptionE_POINTERThrown when there is an attempt to dereference a null object reference.
OperationCanceledExceptionE_ABORTThrown when an operation is aborted.
OutOfBoundsExceptionE_BOUNDSThrown when an operation attempts to access data outside the valid range.
OutOfMemoryExceptionE_OUTOFMEMORYThrown when there's insufficient memory to complete the operation.

Requirements

Minimum supported client: Windows 8

Minimum supported server: Windows Server 2012

Namespace: Platform

Metadata: platform.winmd

COMException::COMException Constructor

Intializes a new instance of the COMException class.

Syntax

COMException(int hresult);

Parameters

hresult
The error HRESULT that is represented by the exception.

COMException::HResult Property

The HRESULT that corresponds to the exception.

Syntax

public: property int HResult { intget(); }

Property Value

An HRESULT value that specifies the error.

Remarks

For more information about how to interpret the HRESULT value, see Structure of COM Error Codes.

COMException::Message Property

Message that describes the exception.

Syntax

public: property String^ Message { String^ get(); }

Property Value

A description of the exception.

See also

Platform namespace

close