CreateObject function winrt
Creates a WinRT object.
final object = CreateObject('Windows.Globalization.Calendar', IID_ICalendar);
final calendar = ICalendar.fromRawPointer(object);
Implementation
Pointer<COMObject> CreateObject(String className, String iid) {
// Activates the specified Windows Runtime class
final inspectablePtr = ActivateClass(className);
// Now use IInspectable to navigate to the relevant interface
final inspectable = IInspectable(inspectablePtr);
final objectPtr = inspectable.toInterface(iid);
inspectable.release();
// Return a pointer to the relevant class
return objectPtr;
}