Re: Notify multiple instances of my COM dll to take an action
- From: "shaji" <shajiparemmal@xxxxxxxxx>
- Date: 28 Feb 2006 21:03:25 -0800
Hi Igor,
This makes things a lot more clearer :)). Thanks a lot.
Now, my dll default interface is derived from IUnknown and the exe
interface is derived from IDispatch. So we have standard marshalling at
the dll level and type library marshalling at the exe level right?
I have a .tlb file in the dll workspace. Further, I succeeded in
passing the pointer into the exe but the method call on that pointer
failed. I passed the pointer using the IUnknown pointer inside a
VARIANT. Is it not possible to call methods that way?
Here are the code snippets at the dl level
HRESULT FinalConstruct()
{
//CoCreate the exe.
HRESULT hr = ::CoCreateInstance(CLSID_ClipBookDbImpl, NULL,
CLSCTX_LOCAL_SERVER, IID_IClipBookDbImpl,
(void**)&m_pICDbExe);
if(SUCCEEDED(hr))
{
VARIANT InterfacePtr;
VariantInit(&InterfacePtr);
InterfacePtr.vt = VT_UNKNOWN;
//IClipBookDB is the
default interface of the dll.
//But the same coclass
implements other intefaces
// derived from
IUnknown
CComQIPtr<IClipBookDB, &IID_IClipBookDB> pClipBok = this;
InterfacePtr.punkVal = pClipBok;
if( InterfacePtr.punkVal != NULL )
hr = m_pICDbExe->RegisterInstance(InterfacePtr);
}
Here is the code snippet at the exe level
STDMETHODIMP CClipBookDbImpl::RegisterInstance(VARIANT
vInterfacePointer)
{
CComQIPtr<IClipBookDB, &IID_IClipBookDB> pClipBok =
(IClipBookDB*)vInterfacePointer.punkVal;
//Call a test method on the pointer passed from dll
HRESULT hr = pClipBok->TestMethod(10); //This call threw the exception
return S_OK;
}
Could you see anything fishy here? How can I build a proxy stub dll in
VC8 and how can I register a type library?
Hope ,I'm not bothering you a lot :))
Shaji.
.
- Follow-Ups:
- Re: Notify multiple instances of my COM dll to take an action
- From: Igor Tandetnik
- Re: Notify multiple instances of my COM dll to take an action
- Prev by Date: Re: Problem in creating a dialog
- Next by Date: Re: IDispEventImpl not firing event methods
- Previous by thread: Re: Problem in creating a dialog
- Next by thread: Re: Notify multiple instances of my COM dll to take an action
- Index(es):
Relevant Pages
|