MSDN Library

CUnknown Class

Microsoft DirectShow 9.0

CUnknown Class

CUnknown Class Hierarchy

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).

© 2015 Microsoft