Important: |
---|
This is retired content. This content is outdated and is no longer being maintained. It is provided as a courtesy for individuals who are still using these technologies. This content may contain URLs that were valid when originally published, but now link to sites or pages that no longer exist. |
A version of IUnknownrenamed to enable a class to support both nondelegating and delegating IUnknowninterfaces in the same COM object.
The interface supports the following three methods, in vtable order.
Syntax
HRESULT NonDelegatingQueryInterface( REFIID iid, void ** ppvObject ); ULONG NonDelegatingAddRef(void); ULONG NonDelegatingRelease(void); |
Remarks
To use INonDelegatingUnknownfor multiple inheritance, perform the following steps:
- Derive your class from an interface, for example,
IMyInterface.
- Include
DECLARE_IUNKNOWNin your class definition to declare
implementations of
QueryInterface,
AddRef, and
Releasethat call the outer unknown.
- Override
NonDelegatingQueryInterfaceto expose
IMyInterfacewith code such as the following.
Copy Code if (riid == IID_IMyInterface) { return GetInterface((IMyInterface *) this, ppv); } else { return CUnknown::NonDelegatingQueryInterface(riid, ppv); }
- Declare and implement the member functions of IMyInterface.
To use INonDelegatingUnknownfor nested interfaces, perform the following steps:
- Declare a class derived from
CUnknown.
- Include
DECLARE_IUNKNOWNin your class definition.
- Override
NonDelegatingQueryInterfaceto expose
IMyInterfacewith the code such as the following:
Copy Code if (riid == IID_IMyInterface) { return GetInterface((IMyInterface *) this, ppv); } else { return CUnknown::NonDelegatingQueryInterface(riid, ppv); }
- Implement the member functions of
IMyInterface.
Use CUnknown::GetOwnerto access the COM object class. - In your COM object class, make the nested class a friend of the
COM object class, and declare an instance of the nested class as a
member of the COM object class.
Because you must always pass the outer unknown and an HRESULTto the CUnknownconstructor, you cannot use a default constructor. You must make the member variable a pointer to the class and make a new call in your constructor to actually create it.
Override the NonDelegatingQueryInterfacewith code such as the following.
Copy Code | |
---|---|
if (riid == IID_IMyInterface) { return m_pImplFilter-> NonDelegatingQueryInterface(IID_IMyInterface, ppv); } else { return CUnknown::NonDelegatingQueryInterface(riid, ppv); } |
You can have mixed classes that support some interfaces through multiple inheritance and some interfaces through nested classes.
Requirements
Windows Embedded CE | Windows CE 2.12 and later |
Windows Mobile | Windows Mobile Version 5.0 and later |
Note | Microsoft DirectShow applications and DirectShow filters have
different include file and Library requirements
For more information, see Setting Up the Build Environment,Version 2.12 requires DXPAK 1.0 or later |