winrt::handle struct (C++/WinRT)

Represents a Windows handle object. winrt::handle is a type alias for winrt::handle_type<winrt::handle_traits>, so see the winrt::handle_type struct template topic to learn about the functions and operators that are available to winrt::handle.

Syntax

struct handle_traits {};

using handle = handle_type<handle_traits>;

Example

winrt::handle h{ ::CreateEvent(nullptr, false, false, nullptr) };
winrt::check_bool(bool{ h });
winrt::check_bool(::SetEvent(h.get()));

Requirements

Minimum supported SDK: Windows SDK version 10.0.17134.0 (Windows 10, version 1803)

Namespace: winrt

Header: %WindowsSdkDir%Include<WindowsTargetPlatformVersion>\cppwinrt\winrt\base.h (included by default)

See also