Click to Rate and Give Feedback
MSDN
MSDN Library
COM
COM Fundamentals
Reference
Interfaces
IUnknown

  Switch on low bandwidth view
IUnknown Interface

Enables clients to get pointers to other interfaces on a given object through the QueryInterface method, and manage the existence of the object through the AddRef and Release methods. All other COM interfaces are inherited, directly or indirectly, from IUnknown. Therefore, the three methods in IUnknown are the first entries in the VTable for every interface.

When To Implement

You must implement IUnknown as 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 IUnknown once for each interface you implement.

When To Use

Use IUnknown methods to switch between interfaces on an object, add references, and release objects.

Methods

The IUnknown interface defines the following methods.

MethodDescription

QueryInterface

Retrieves pointers to the supported interfaces on an object.

AddRef

Increments the reference count for an interface on an object.

Release

Decrements the reference count for an interface on an object.

 

Requirements

Minimum supported clientWindows 2000 Professional
Minimum supported serverWindows 2000 Server
HeaderUnknwn.h
IDLUnknwn.idl
IIDIID_IUnknown is defined as 00000000-0000-0000-C000-000000000046

See Also

Using and Implementing IUnknown

Send comments about this topic to Microsoft

Build date: 7/9/2009

Tags What's this?: Add a tag
Community Content   What is Community Content?
Add new content RSS  Annotations
Processing
© 2009 Microsoft Corporation. All rights reserved. Terms of Use  |  Trademarks  |  Privacy Statement
Page view tracker