HString 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 HString Class.

Provides support for manipulating HSTRING handles.

class HString;  

The Windows Runtime provides access to strings through HSTRING handles. The HString class provides convenience functions and operators to simplify using HSTRING handles.

Public Constructors

HString::HString ConstructorInitializes a new instance of the HString class.
HString::~HString DestructorDestroys the current instance of the HString class.


HString::Set MethodSets the value of the current HString object to the specified wide-character string or HString parameter.
HString::Attach MethodAssociates the specified HString object with the current HString object.
HString::CopyTo MethodCopies the current HString object to an HSTRING object.
HString::Detach MethodDisassociates the specified HString object from its underlying value.
HString::GetAddressOf MethodRetrieves a pointer to the underlying HSTRING handle.
HString::Get MethodRetrieves the value of the underlying HSTRING handle.
HString::Release MethodDeletes the underlying string value and intializes the current HString object to an empty value.
HString::MakeReference MethodCreates an HStringReference object from a specified string parameter.

Public Operators

HString::Operator= OperatorMoves the value of another HString object to the current HString object.
HString::Operator== OperatorIndicates whether the two parameters are equal.
HString::Operator!= OperatorIndicates whether the two parameters are not equal.


Header: corewrappers.h

Namespace: Microsoft::WRL::Wrappers

Microsoft::WRL::Wrappers Namespace