Important: |
---|
This is retired content. This content is outdated and is no longer being maintained. It is provided as a courtesy for individuals who are still using these technologies. This content may contain URLs that were valid when originally published, but now link to sites or pages that no longer exist. |
The IUnknowninterface lets clients get pointers to other interfaces on a given object through the IUnknown::QueryInterfacemethod, and manage the existence of the object through the IUnknown::AddRefand IUnknown::Releasemethods. All other Component Object Model (COM) interfaces are inherited, directly or indirectly, from IUnknown. Therefore, the three methods in IUnknownare the first entries in the vtable for every interface.
This interface and its methods are fully described in the COM documentation and are only partially documented here for quick reference.
When to Implement
You must implement IUnknownas part of every interface. If you are using C++ multiple inheritance to implement multiple interfaces, the various interfaces can share one implementation of IUnknown. If you are using nested classes to implement multiple interfaces, you must implement IUnknownonce for each interface you implement.
Note The IUnknowninterface is implemented by the CUnknownbase class in the Microsoft DirectShow class library and so is inherited by most other classes.
When to Use
Use IUnknownmethods to switch between interfaces on an object, add references, and release objects.
Methods in Vtable Order
IUnknown methods | Description |
---|---|
QueryInterface | Returns pointers to supported interfaces. |
AddRef | Increments the reference count. |
Release | Decrements the reference count. |