Represents a weak reference that can be used by only the Windows Runtime, not classic COM. A weak reference represents an object that might or might not be accessible.
A WeakRef object maintains a strong reference, which is associated with an object, and can be valid or invalid. Call the As() or AsIID() method to obtain a strong reference. When the strong reference is valid, it can access the associated object. When the strong reference is invalid (nullptr), the associated object is inaccessible.
A WeakRef object is typically used to represent an object whose existence is controlled by an external thread or application. For example, construct a WeakRef object from a reference to a file object. While the file is open, the strong reference is valid. But if the file is closed, the strong reference becomes invalid.
Sets the specified ComPtr pointer parameter to represent the specified interface.
Sets the specified ComPtr pointer parameter to represent the specified interface ID.
Assigns a pointer to an interface, if available, to the specified pointer variable.
Returns a ComPtrRef object that represents the current WeakRef object.