description | title | ms.date | ms.topic | f1_keywords | helpviewer_keywords | ms.assetid | ||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Learn more about: HandleT Class |
HandleT Class |
10/03/2018 |
reference |
|
|
3822b32a-a426-4d94-a54d-919d4df60ee2 |
Represents a handle to an object.
template <typename HandleTraits>
class HandleT;
HandleTraits
An instance of the HandleTraits structure that defines common characteristics of a handle.
Name | Description |
---|---|
Traits |
A synonym for HandleTraits . |
Name | Description |
---|---|
HandleT::HandleT | Initializes a new instance of the HandleT class. |
HandleT::~HandleT | Deinitializes an instance of the HandleT class. |
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. |
Name | Description |
---|---|
HandleT::InternalClose | Closes the current HandleT object. |
Name | Description |
---|---|
HandleT::operator= | Moves the value of the specified HandleT object to the current HandleT object. |
Name | Description |
---|---|
HandleT::handle_ | Contains the handle that is represented by the HandleT object. |
HandleT
Header: corewrappers.h
Namespace: Microsoft::WRL::Wrappers
Deinitializes an instance of the HandleT
class.
~HandleT();
Associates the specified handle with the current HandleT
object.
void Attach(
typename HandleTraits::Type h
);
h
A handle.
Closes the current HandleT
object.
void Close();
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.
Disassociates the current HandleT
object from its underlying handle.
typename HandleTraits::Type Detach();
The underlying handle.
When this operation completes, the current HandleT
is set to the invalid state.
Gets the value of the underlying handle.
typename HandleTraits::Type Get() const;
A handle.
Contains the handle that is represented by the HandleT
object.
typename HandleTraits::Type handle_;
Initializes a new instance of the HandleT
class.
explicit HandleT(
typename HandleTraits::Type h =
HandleTraits::GetInvalidValue()
);
HandleT(
_Inout_ HandleT&& h
);
h
A handle.
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.
Closes the current HandleT
object.
virtual bool InternalClose();
true
if the current HandleT
closed successfully; otherwise, false
.
InternalClose()
is protected
.
Indicates whether the current HandleT
object represents a handle.
bool IsValid() const;
true
if the HandleT
represents a handle; otherwise, false
.
Moves the value of the specified HandleT
object to the current HandleT
object.
HandleT& operator=(
_Inout_ HandleT&& h
);
h
An rvalue-reference to a handle.
A reference to the current HandleT
object.
This operation invalidates the HandleT
object specified by parameter h.