Windows API Interfaces

Interface Details

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

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

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