|Microsoft DirectShow 9.0|
The CUnknown object implements the IUnknown interface. Most Component Object Model (COM) objects in Microsoft® DirectShow® derive from CUnknown.
If you implement a COM object, you might want to derive it from CUnknown. Deriving from CUknown provides a thread-safe implementation, and saves you the trouble of implementing IUnknown.
For a detailed discussion of how to use this base class, see How to Implement IUnknown. What follows is a brief summary:
- Include the DECLARE_IUNKNOWN macro in the public section of your class definition. This macro declares the three methods of the IUnknown interface.
- Override the NonDelegatingQueryInterface method to support interfaces other than IUnknown. Within this method, call the GetInterface function to retrieve interface pointers.
- In your class constructor, invoke the CUnknown constructor method.
Header: Declared in Combase.h; include Streams.h.
Library: Use Strmbase.lib (retail builds) or Strmbasd.lib (debug builds).
Protected Member Variables m_cRef Reference count. Public Methods CUnknown Constructor method. ~CUnknown Destructor method. Virtual. GetOwner Retrieves a pointer to the controlling IUnknown. INonDelegatingUnknown Methods NonDelegatingAddRef Increments the reference count. NonDelegatingQueryInterface Retrieves an interface pointer and increments the reference count. NonDelegatingRelease Decrements the reference count.