QueryInterface woes with multiple interfaces (only one dispinterface)
- From: "Jason S" <jmsachs@xxxxxxxxx>
- Date: 24 Mar 2006 18:09:04 -0800
argh... this is driving me crazy. I have a couple of objects which I'm
trying to implement multiple interfaces. One is a dispinterface that is
used for scripting languages, the other(s) are regular (not disp/dual
interfaces) used among my objects for inter-object communication.
If I look at the object's type library, the multiple interfaces show up
(using OLE/COM Viewer) in the coclass definition & I can see all the
methods. I've put them in my COM_MAP in the class's .h file. It looks
like if I QueryInterface from within the object's apartment, they all
show up. But if I QueryInterface a proxy, the other interfaces aside
from the dispinterfaces, fail with 0x80004002 (no such interface). If I
use OLE/COM Viewer to look at the class itself, those interfaces don't
show up either. I am confused!
from my .idl file (is this the right syntax for multiple interfaces? I
can't find an example):
coclass datastream
{
[default] interface Idatastream;
interface Irawdata_private;
};
from my .h file for the class:
/////////////////////////////////////////////////////////////////////////////
// Cdatastream
class ATL_NO_VTABLE Cdatastream :
public CComObjectRootEx<CComMultiThreadModel>,
public CComCoClass<Cdatastream, &CLSID_datastream>,
public ISupportErrorInfo,
public IDispatchImpl<Idatastream, &IID_Idatastream, &LIBID_DKEDXLib>,
public Irawdata_private
{
... other stuff ...
BEGIN_COM_MAP(Cdatastream)
COM_INTERFACE_ENTRY(Idatastream)
COM_INTERFACE_ENTRY(IDispatch)
COM_INTERFACE_ENTRY(ISupportErrorInfo)
COM_INTERFACE_ENTRY(Irawdata_private)
END_COM_MAP()
Irawdata_private (which derives from IUnknown, neither Idatastream nor
Irawdata_private depends on each other) does not seem to QueryInterface
properly work.
What kind of things should I look for? I'm perplexed.
.
- Follow-Ups:
- Re: QueryInterface woes with multiple interfaces (only one dispinterface)
- From: Igor Tandetnik
- Re: QueryInterface woes with multiple interfaces (only one dispinterface)
- Prev by Date: Re: How to ensure only one instance of COM Server(dll) running in system?
- Next by Date: Re: QueryInterface woes with multiple interfaces (only one dispinterface)
- Previous by thread: Sizing Windowless Control
- Next by thread: Re: QueryInterface woes with multiple interfaces (only one dispinterface)
- Index(es):
Relevant Pages
|