   COM Connection Points: Problem to create an instance of an sink object.
  Hi All,I’m an absolutely newbie in the COM technology and I have a little tricky question. I hope there’s someone out there who can help me with my problem. I have an .idl / .h / .c file and I integrated them in my VisualStudio 2005 C++ project. After that I’ve searched on the MSDN Library how I can connect an COM Server from my project. I’ve found a little example (http://msdn.microsoft.com/en-us/magazine/cc163361.aspx) and tried to do it on the same way. I’ve created an Csink class and tried to create an instance of this sink object to pass to the server. But the problem now I get from my compiler is the following error message: „error C2259: 'CSink': cannot instantiate abstract class due to following members: 'HRESULT IUnknown::QueryInterface(const IID &,void **)' : is abstract“. Thiss Error message will come in the c++ file after the „pSink = new CSink();“ line. The thing I need is that I must call the „ OnShowMessageDlg “ and the „ OnConfigurationApply “ functions out of the .idl file in my main c++ function. I’ve put all the code here below in this entry. I hope that could help you to become an overview about my problem. Is the solution I’ve tried with the sink object correct or should I use another way to do this?Please let me know if you need any other information.Thanks for ANY help. Juergen*************************************************************************************************.idl file...// TLib :// TLib : OLE Automation : {00020430-0000-0000-C000-000000000046}    importlib("stdole2.tlb");    // Forward declare all types defined in this typelib    interface ITEST2;    dispinterface ITESTEvents;...[ uuid(6775FB91-B5BE-11D6-A996-0050BA24C7B9), version(1.1), helpstring("Event dispatch interface for TEST")]dispinterface ITESTEvents {   properties:   methods:  [id(0x00000001)]  void OnConfigurationApply([in, out] VARIANT_BOOL* pAccept);  [id(0x00000002)]  void OnShowMessageDlg(   [in] IMsgDlg* pIMsg,    [out, retval] VARIANT_BOOL* Result);};....    coclass TESTv2 {   [default] interface ITEST2;   [default, source] dispinterface ITESTEvents;    };*************************************************************************************************.h file...EXTERN_C const IID DIID_ITESTEvents;#if defined(__cplusplus) && !defined(CINTERFACE)    MIDL_INTERFACE("6775FB91-B5BE-11D6-A996-0050BA24C7B9")    ITESTEvents : public IDispatch    {    };    #else /* C style interface */    typedef struct ITESTEventsVtbl    {   BEGIN_INTERFACE HRESULT ( STDMETHODCALLTYPE *QueryInterface )(   ITESTEvents * This,  /* [in] */ REFIID riid,  /* [iid_is][out] */ void **ppvObject);...*************************************************************************************************.c file...MIDL_DEFINE_GUID(IID, IID_ITEST2,0xF560F761,0x2948,0x11D7,0xA9,0xBF,0x00,0x50,0xBA,0x24,0xC7,0xB9);MIDL_DEFINE_GUID(IID, DIID_ITESTEvents,0x6775FB91,0xB5BE,0x11D6,0xA9,0x96,0x00,0x50,0xBA,0x24,0xC7,0xB9);MIDL_DEFINE_GUID(CLSID, CLSID_TESTv2,0xF560F763,0x2948,0x11D7,0xA9,0xBF,0x00,0x50,0xBA,0x24,0xC7,0xB9);...*************************************************************************************************.c++ fileclass CSink : public ITESTEvents{private:    DWORD  m_dwRefCount;    public:CSink::CSink() {m_dwRefCount = 0;}CSink::~CSink(){}   void OnConfigurationApply(VARIANT_BOOL* pAccept);void OnShowMessageDlg(IMsgDlg* pIMsg, VARIANT_BOOL* Result);};void main(){...CSink *pSink;pSink = new CSink(); // ERROR MESSAGE..}*************************************************************************************************   
  Hi, I don't if this could be handy for you but I learned a lot about how to creates  for an embedded InternetExplorer by reading this article:Handling HTML Element Events .Hope this is helpful for you.With best regards,Kimmi   ;  Hi Kimmi, thanks for this hint. I've found an similar example and I've tried to make my code like this. But now I can't go on because of the error message I'll become. But anyway thanks for your help.Does anyone have some other ideas?Best regards,Juergen   ;  You have to implement the QueryInterface method on your own. Just look into the declaration of IDisplatch to see which methods are abstract.In this tutorial you can see a simple example from Microsoft, where a simple IDispatch interface is implemented.Edit: You can use code tags to make your code more readable. Just look into the FAQ to learn how to do this.Greetings,Kimmi[Edited by - Kimmi on September 8, 2009 8:37:08 AM];  Hi Kimmi,thanks for that link. I think, now I can begin with the next step. Best regards,Juergen