A helper function that retrieves a string containing the fully-qualified type name of the Windows Runtime class represented by an object of a given projected type. This is the same value returned from a call to IInspectable::GetRuntimeClassName.
This is a free function that retrieves the runtime class name of any arbitrary IInspectable. For the automatically-generated member function that's available only on implementation types, see GetRuntimeClassName. For an explanation of the implementation type and projected type concepts, see Consume APIs with C++/WinRT and Author APIs with C++/WinRT.
Syntaxinline winrt::hstring get_class_name(winrt::Windows::Foundation::IInspectable const& object);
Parameters
object
An instance of the projected type for a Windows Runtime class (any runtime class; whether it's a Windows type, or a second- or third-party type).
A winrt::hstring containing the fully-qualified type name of the Windows Runtime class represented by object
. Note that the type of the Windows Runtime class is returned, not that of the projected type. In the example below, the C++/WinRT projected type is winrt::Windows::Foundation::Uri, but the value returned from winrt::get_class_name is "Windows.Foundation.Uri", which is the type name of the runtime class.
winrt::Windows::Foundation::Uri contosoUri{ L"https://www.contoso.com" };
winrt::hstring name = winrt::get_class_name(contosoUri);
assert(name == L"Windows.Foundation.Uri");
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 alsoRetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4