Windows API Interfaces
-
IUnknown
The base interface for all Component Object Model (COM) interfaces.
-
IDispatch
Provides a standard way to access OLE Automation properties and methods.
-
IClassFactory
Creates objects that implement a specified COM interface.
-
IMalloc
Provides methods for memory allocation and deallocation.
-
IBindHost
Used to bind moniker-bound objects.
-
IEnumUnknown
Enumerates a sequence of IUnknown pointers.
-
IEnumString
Enumerates a sequence of strings.
IUnknown
Interface Definition
interface IUnknown {
virtual HRESULT QueryInterface(
REFIID riid,
[out, iid_is(riid)] void **ppvObject
) = 0;
virtual ULONG AddRef( void) = 0;
virtual ULONG Release( void) = 0;
};
Description
The IUnknown
interface is the base interface from which all other COM interfaces inherit. It provides the fundamental reference counting and querying capabilities that are essential for managing the lifetime and discovering the capabilities of COM objects.
Methods
QueryInterface
: Retrieves pointers to the various interfaces that a COM object supports.AddRef
: Increments the reference count for an interface on an object.Release
: Decrements the reference count for an interface on an object.
IDispatch
Interface Definition
interface IDispatch : public IUnknown {
virtual HRESULT GetTypeInfoCount(
[out] unsigned int *pctinfo
) = 0;
virtual HRESULT GetTypeInfo(
unsigned int iTInfo,
LCID lcid,
[out] ITypeInfo **ppTInfo
) = 0;
virtual HRESULT GetIDsOfNames(
[in] REFIID riid,
[in, size_is(cNames)] LPCOLESTR *rgszNames,
[in] unsigned int cNames,
[in] LCID lcid,
[out, size_is(cNames)] DISPID *rgDispId
) = 0;
virtual HRESULT Invoke(
DISPID dispIdMember,
[in] REFIID riid,
[in] LCID lcid,
[in] WORD wFlags,
[in, out] DISPPARAMS *pDispParams,
[out] VARIANT *pVarResult,
[out] EXCEPINFO *pExcepInfo,
[out] unsigned int *puArgErr
) = 0;
};
Description
The IDispatch
interface is an extension of IUnknown
that provides late-bound access to an object's properties and methods. It is fundamental to OLE Automation and is used by scripting languages and other clients that need to interact with COM objects dynamically.
Methods
GetTypeInfoCount
: Retrieves the number of type information interfaces supported by the object.GetTypeInfo
: Retrieves the type information for the object.GetIDsOfNames
: Maps a set of names to a corresponding set of dispatch identifiers (DISPIDs).Invoke
: Provides access to properties and methods exposed by an OLE object.
IClassFactory
Interface Definition
interface IClassFactory : public IUnknown {
virtual HRESULT CreateInstance(
[in, unique] IUnknown *pUnkOuter,
[in] REFIID riid,
[out, iid_is(riid)] void **ppvObject
) = 0;
virtual HRESULT LockServer(
[in] BOOL fLock
) = 0;
};
Description
The IClassFactory
interface is implemented by COM objects that support instantiation. It is used by COM clients to create instances of objects managed by a particular class.
Methods
CreateInstance
: Creates an object that implements the interface specified byriid
.LockServer
: Locks the running server application in memory.