Hi,
I am trying to add a method in a COM Interface. I know trhere is an "Add Method" wizard but it is not working due to some unknown problem (probably because the project was a VC 6.0 project which is now ported to VC 7.1).
My requirement was that, I want to add the method in the COM object and access it through VB. I can use VS 7.1 or VS 8.0.
I tried the following steps:
1. Add the method in the IDL file with a new id: // (Already exposed 11 methods in the IDL)
2. Add a declaration in the header file of the COM class:Code:[id(12), helpstring("method Sub")] HRESULT Sub([in] BSTR sSource, [in] BSTR sDestination, [in] VARIANT* objOptions, [in] VARIANT* objHandler, [out,retval] BSTR* pVal);
3. Add the method implementation to the CPP file:Code:public: STDMETHOD(Sub)(BSTR sSource, BSTR sDestination, VARIANT* objOptions, VARIANT* objHandler, BSTR* pVal);
I Built the project, registered the COM DLL and observed that the new method I have added are not Visible (or rather to say not exposed). Neither a VB based client not a .NET application can see the newly added "Sub" method. Using the "OLE View" application I opened the newly generated TypeLib, but surprised that the TypeLib contains the newly added method but the registered DLL doesn't expose them.Code:STDMETHODIMP CMyComClass::Sub(BSTR sSource, BSTR sDestination, VARIANT* objOptions, VARIANT* objHandler, BSTR* pVal) { MessageBoxW(0, L"Inside CMyComClass::Sub()", L"On Call", 0) ; return S_OK; }
Confusion !! :-(
Can some one through Light on this and suggest how to add a method that can be visible to VB/.NET clients ?
Thanks.
*(Vipul)( ) ;





Reply With Quote