Wednesday, November 19, 2008

IUnknown interface


Traditional explanations of COM start out with a thorough description of the IUnknown interface. IUnknown is the fundamental basis for all COM interfaces. Despite its importance, you don't need to know about IUnknown to understand the interface concept. The implementation of IUnknown is hidden by the higher level abstractions we'll be using to build our COM objects. Actually, paying too much attention to IUnknown can be confusing. Let's deal with it at a high level here so you understand the concepts.

IUnknown is like an abstract base class in C++. All COM interfaces must inherit from IUnknown. IUnknown handles the creation and management of the interface. The methods of IUnknown are used to create, reference count, and release a COM object. All COM interfaces implement these 3 methods and they are used internally by COM to manage interfaces. You will likely never call these 3 methods yourself.

0 comments: