Re: Notify multiple instances of my COM dll to take an action



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.

.



Relevant Pages

  • Re: hosting the runtime
    ... >> and you know the name of the DLL. ... >> usually created by class factory objects, ... >> class to this function and it will return the class factory interface of ... >> so all you get back is a pointer to a table of pointers). ...
    (microsoft.public.dotnet.framework)
  • Re: hosting the runtime
    ... its worth pointing out that a COM interface is very much like a ... class and you know the name of the DLL. ... objects are usually created by class factory objects, ... v-table pointer, so all you get back is a pointer to a table of ...
    (microsoft.public.dotnet.framework)
  • Re: Passing pointers using a VARIANT
    ... You don't pass classes in COM - you pass interface pointers. ... Why do you believe it needs to be a COM DLL? ... the only way I can get that to work is if I cast the pointer ... What's the threading model of the component? ...
    (microsoft.public.vc.atl)
  • Re: Automating Internet Explorer
    ... > Not all objects expose an Automation interface. ... but has not exposed a programmability interface. ... > You changed a project from .dll to .exe, ...
    (microsoft.public.vb.general.discussion)
  • Accessing a C# delegate used in a C# interface....
    ... to implement the project in VB.NET, so the EXE project is a VB WinForms ... Of interest in my problem are two C# DLL projects aside from the main ... Then, an interface in the ... Remember that the interface in B, uses the delegate in A, so ...
    (microsoft.public.dotnet.languages.vb)