For the latest documentation on Visual Studio 2017 RC, see Visual Studio 2017 RC Documentation.
Supports the WRL infrastructure and is not intended to be used directly from your code.
Represents a weak reference that can be used with the Windows Runtime or classic COM. A weak reference represents an object that might or might not be accessible.
WeakReference object maintains a strong reference, which is a pointer to an object, and a strong reference count, which is the number of copies of the strong reference that have been distributed by the Resolve() method. While the strong reference count is nonzero, the strong reference is valid and the object is accessible. When the strong reference count becomes zero, the strong reference is invalid and the object is inaccessible.
A WeakReference object is typically used to represent an object whose existence is controlled by an external thread or application. For example, construct a WeakReference 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.
The WeakReference methods are thread safe.
|WeakReference::WeakReference Constructor||Initializes a new instance of the WeakReference class.|
|WeakReference::~WeakReference Destructor||Deinitializes (destroys) the current instance of the WeakReference class.|
|WeakReference::DecrementStrongReference Method||Decrements the strong reference count of the current WeakReference object.|
|WeakReference::IncrementStrongReference Method||Increments the strong reference count of the current WeakReference object.|
|WeakReference::Resolve Method||Sets the specified pointer to the current strong reference value if the strong reference count is nonzero.|
|WeakReference::SetUnknown Method||Sets the strong reference of the current WeakReference object to the specified interface pointer.|