Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Represents a handle to an object.
Syntax
template <typename HandleTraits>
class HandleT;
Parameters
HandleTraits
An instance of the HandleTraits structure that defines common characteristics of a handle.
Members
Public Typedefs
| Name | Description |
|---|---|
Traits |
A synonym for HandleTraits. |
Public Constructors
| Name | Description |
|---|---|
| HandleT::HandleT | Initializes a new instance of the HandleT class. |
| HandleT::~HandleT | Deinitializes an instance of the HandleT class. |
Public Methods
| Name | Description |
|---|---|
| HandleT::Attach | Associates the specified handle with the current HandleT object. |
| HandleT::Close | Closes the current HandleT object. |
| HandleT::Detach | Disassociates the current HandleT object from its underlying handle. |
| HandleT::Get | Gets the value of the underlying handle. |
| HandleT::IsValid | Indicates whether the current HandleT object represents a handle. |
Protected Methods
| Name | Description |
|---|---|
| HandleT::InternalClose | Closes the current HandleT object. |
Public Operators
| Name | Description |
|---|---|
| HandleT::operator= | Moves the value of the specified HandleT object to the current HandleT object. |
Protected Data Members
| Name | Description |
|---|---|
| HandleT::handle_ | Contains the handle that is represented by the HandleT object. |
Inheritance Hierarchy
HandleT
Requirements
Header: corewrappers.h
Namespace: Microsoft::WRL::Wrappers
HandleT::~HandleT
Deinitializes an instance of the HandleT class.
~HandleT();
HandleT::Attach
Associates the specified handle with the current HandleT object.
void Attach(
typename HandleTraits::Type h
);
Parameters
h
A handle.
HandleT::Close
Closes the current HandleT object.
void Close();
Remarks
The handle that underlies the current HandleT is closed, and the HandleT is set to the invalid state.
If the handle doesn't close properly, an exception is raised in the calling thread.
HandleT::Detach
Disassociates the current HandleT object from its underlying handle.
typename HandleTraits::Type Detach();
Return Value
The underlying handle.
Remarks
When this operation completes, the current HandleT is set to the invalid state.
HandleT::Get
Gets the value of the underlying handle.
typename HandleTraits::Type Get() const;
Return Value
A handle.
HandleT::handle_
Contains the handle that is represented by the HandleT object.
typename HandleTraits::Type handle_;
HandleT::HandleT
Initializes a new instance of the HandleT class.
explicit HandleT(
typename HandleTraits::Type h =
HandleTraits::GetInvalidValue()
);
HandleT(
_Inout_ HandleT&& h
);
Parameters
h
A handle.
Remarks
The first constructor initializes a HandleT object that is not a valid handle to an object. The second constructor creates a new HandleT object from parameter h.
HandleT::InternalClose
Closes the current HandleT object.
virtual bool InternalClose();
Return Value
true if the current HandleT closed successfully; otherwise, false.
Remarks
InternalClose() is protected.
HandleT::IsValid
Indicates whether the current HandleT object represents a handle.
bool IsValid() const;
Return Value
true if the HandleT represents a handle; otherwise, false.
HandleT::operator=
Moves the value of the specified HandleT object to the current HandleT object.
HandleT& operator=(
_Inout_ HandleT&& h
);
Parameters
h
An rvalue-reference to a handle.
Return Value
A reference to the current HandleT object.
Remarks
This operation invalidates the HandleT object specified by parameter h.