|Microsoft DirectX 9.0|
All Component Object Model (COM) objects support an interface called IUnknown. This interface provides Microsoft?DirectX?with control of the object's lifetime and the ability to retrieve other interfaces implemented by the object. IUnknown has three methods.
Increases the interface's reference count by 1.
Determines whether the object supports a particular COM interface. If it does, the system increases the object's reference count, and the application can use that interface immediately.
Release Decreases the reference count of the interface by 1.
The IUnknown::AddRef and IUnknown::Release methods maintain an object's reference count. For example, if you create a Microsoft Direct3D?object, the object's reference count is set to 1. Every time a function returns a pointer to an interface for that object, the function must call IUnknown::AddRef through that pointer to increment the reference count. Match each IUnknown::AddRef call with a call to IUnknown::Release. Before the pointer can be destroyed, you must call IUnknown::Release through that pointer. After an object's reference count reaches 0, the object is destroyed, and all interfaces to it become invalid.
The IUnknown::QueryInterface method determines whether an object supports a specific interface. If an object supports an interface, IUnknown::QueryInterface returns a pointer to that interface. You then can use the methods of that interface to communicate with the object. If IUnknown::QueryInterface successfully returns a pointer to an interface, it implicitly calls IUnknown::AddRef to increment the reference count, so your application must call IUnknown::Release to decrement the reference count before destroying the pointer to the interface.Note The reference pages for IUnknown are included with this documentation as a convenience for users of the stand-alone DirectX Help file. Refer to the Microsoft Platform Software Development Kit (SDK) documentation for the most complete and up-to-date information about this interface.
Inherits from None Header unknwn.h Minimum operating systems Windows 98