winrt::create_instance function template (C++/WinRT)
A function template that creates a single uninitialized object of the class associated with a specified CLSID, and returns it as a winrt::com_ptr or throws if not successful.
template <typename Interface> winrt::com_ptr<Interface> create_instance(guid const& clsid, uint32_t context = 0x1 /*CLSCTX_INPROC_SERVER*/, void* outer = nullptr);
The type of the interface pointer to query for on the newly created object.
The CLSID associated with the data and code that will be used to create the object.
Context in which the code that manages the newly created object will run. The values are taken from the enumeration CLSCTX.
nullptr, indicates that the object is not being created as part of an aggregate. If not
nullptr, a pointer to the aggregate object's IUnknown interface (the controlling IUnknown).
A winrt::com_ptr of the newly created object. Throws if not successful.
Minimum supported SDK: Windows SDK version 10.0.17134.0 (Windows 10, version 1803)
Header: %WindowsSdkDir%Include<WindowsTargetPlatformVersion>\cppwinrt\winrt\base.h (included by default)