Compartilhar via


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.

Requirements

**  Header:** Declared in Combase.h; include Streams.h.

**  Library:** Use Strmbase.lib (retail builds) or Strmbasd.lib (debug builds).

-

<table>
<tbody>
<tr class="odd">
<td><strong>Protected Member Variables</strong></td>
<td> </td>
</tr>
<tr class="even">
<td><a href="ms783090(v=vs.85).md"><strong>m_cRef</strong></a></td>
<td>Reference count.</td>
</tr>
<tr class="odd">
<td><strong>Public Methods</strong></td>
<td> </td>
</tr>
<tr class="even">
<td><a href="ms783087(v=vs.85).md"><strong>CUnknown</strong></a></td>
<td>Constructor method.</td>
</tr>
<tr class="odd">
<td><a href="ms783088(v=vs.85).md">~<strong>CUnknown</strong></a></td>
<td>Destructor method. <em>Virtual.</em></td>
</tr>
<tr class="even">
<td><a href="ms783089(v=vs.85).md"><strong>GetOwner</strong></a></td>
<td>Retrieves a pointer to the controlling <strong>IUnknown</strong>.</td>
</tr>
<tr class="odd">
<td><strong>INonDelegatingUnknown Methods</strong></td>
<td> </td>
</tr>
<tr class="even">
<td><a href="ms783091(v=vs.85).md"><strong>NonDelegatingAddRef</strong></a></td>
<td>Increments the reference count.</td>
</tr>
<tr class="odd">
<td><a href="ms783092(v=vs.85).md"><strong>NonDelegatingQueryInterface</strong></a></td>
<td>Retrieves an interface pointer and increments the reference count.</td>
</tr>
<tr class="even">
<td><a href="ms783093(v=vs.85).md"><strong>NonDelegatingRelease</strong></a></td>
<td>Decrements the reference count.</td>
</tr>
</tbody>
</table>