Click here to Skip to main content
15,887,214 members
Articles / Desktop Programming / ATL

Simulate COM Connection Points from a .NET Library

Rate me:
Please Sign up or sign in to vote.
4.91/5 (25 votes)
8 Mar 2006CPOL14 min read 63.3K   1.4K   36  
An article on accessing a VB.NET library from a MFC/ATL COM client.

/* this ALWAYS GENERATED file contains the definitions for the interfaces */


 /* File created by MIDL compiler version 6.00.0361 */
/* at Tue Aug 16 13:14:09 2005
 */
/* Compiler settings for .\CustomHashtable.idl:
    Oicf, W1, Zp8, env=Win32 (32b run)
    protocol : dce , ms_ext, c_ext, robust
    error checks: allocation ref bounds_check enum stub_data 
    VC __declspec() decoration level: 
         __declspec(uuid()), __declspec(selectany), __declspec(novtable)
         DECLSPEC_UUID(), MIDL_INTERFACE()
*/
//@@MIDL_FILE_HEADING(  )

#pragma warning( disable: 4049 )  /* more than 64k source lines */


/* verify that the <rpcndr.h> version is high enough to compile this file*/
#ifndef __REQUIRED_RPCNDR_H_VERSION__
#define __REQUIRED_RPCNDR_H_VERSION__ 475
#endif

#include "rpc.h"
#include "rpcndr.h"

#ifndef __RPCNDR_H_VERSION__
#error this stub requires an updated version of <rpcndr.h>
#endif // __RPCNDR_H_VERSION__


#ifndef __CustomHashtable_h__
#define __CustomHashtable_h__

#if defined(_MSC_VER) && (_MSC_VER >= 1020)
#pragma once
#endif

/* Forward Declarations */ 

#ifndef __ITGHashtable_FWD_DEFINED__
#define __ITGHashtable_FWD_DEFINED__
typedef interface ITGHashtable ITGHashtable;
#endif 	/* __ITGHashtable_FWD_DEFINED__ */


#ifndef __TGHashtable_FWD_DEFINED__
#define __TGHashtable_FWD_DEFINED__

#ifdef __cplusplus
typedef class TGHashtable TGHashtable;
#else
typedef struct TGHashtable TGHashtable;
#endif /* __cplusplus */

#endif 	/* __TGHashtable_FWD_DEFINED__ */


/* header files for imported files */
#include "oaidl.h"
#include "ocidl.h"

#ifdef __cplusplus
extern "C"{
#endif 

void * __RPC_USER MIDL_user_allocate(size_t);
void __RPC_USER MIDL_user_free( void * ); 


#ifndef __CustomHashtableLib_LIBRARY_DEFINED__
#define __CustomHashtableLib_LIBRARY_DEFINED__

/* library CustomHashtableLib */
/* [helpstring][version][uuid] */ 


EXTERN_C const IID LIBID_CustomHashtableLib;

#ifndef __ITGHashtable_INTERFACE_DEFINED__
#define __ITGHashtable_INTERFACE_DEFINED__

/* interface ITGHashtable */
/* [unique][helpstring][nonextensible][dual][uuid][object] */ 


EXTERN_C const IID IID_ITGHashtable;

#if defined(__cplusplus) && !defined(CINTERFACE)
    
    MIDL_INTERFACE("CD32BAFF-D5E1-4726-9D76-9B2C8E6C97AA")
    ITGHashtable : public IDispatch
    {
    public:
        virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_InnerHashtable( 
            /* [retval][out] */ /* external definition not present */ _Hashtable **pVal) = 0;
        
        virtual /* [helpstring][id][propput] */ HRESULT STDMETHODCALLTYPE put_InnerHashtable( 
            /* [in] */ /* external definition not present */ _Hashtable *newVal) = 0;
        
        virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_Count( 
            /* [retval][out] */ long *pVal) = 0;
        
        virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_Values( 
            /* [retval][out] */ /* external definition not present */ ICollection **pVal) = 0;
        
        virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_Keys( 
            /* [retval][out] */ /* external definition not present */ ICollection **pVal) = 0;
        
        virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_Item( 
            /* [in] */ VARIANT key,
            /* [retval][out] */ VARIANT *pVal) = 0;
        
        virtual /* [helpstring][id][propputref] */ HRESULT STDMETHODCALLTYPE putref_Item( 
            /* [in] */ VARIANT key,
            /* [in] */ VARIANT pVal) = 0;
        
        virtual HRESULT STDMETHODCALLTYPE Contains( 
            VARIANT key,
            /* [retval][out] */ VARIANT_BOOL *pRetVal) = 0;
        
        virtual HRESULT STDMETHODCALLTYPE Add( 
            VARIANT key,
            VARIANT value) = 0;
        
        virtual HRESULT STDMETHODCALLTYPE Clear( void) = 0;
        
        virtual HRESULT STDMETHODCALLTYPE Remove( 
            VARIANT key) = 0;
        
        virtual HRESULT STDMETHODCALLTYPE GetEnumerator( 
            /* [retval][out] */ /* external definition not present */ IDictionaryEnumerator **pRetVal) = 0;
        
    };
    
#else 	/* C style interface */

    typedef struct ITGHashtableVtbl
    {
        BEGIN_INTERFACE
        
        HRESULT ( STDMETHODCALLTYPE *QueryInterface )( 
            ITGHashtable * This,
            /* [in] */ REFIID riid,
            /* [iid_is][out] */ void **ppvObject);
        
        ULONG ( STDMETHODCALLTYPE *AddRef )( 
            ITGHashtable * This);
        
        ULONG ( STDMETHODCALLTYPE *Release )( 
            ITGHashtable * This);
        
        HRESULT ( STDMETHODCALLTYPE *GetTypeInfoCount )( 
            ITGHashtable * This,
            /* [out] */ UINT *pctinfo);
        
        HRESULT ( STDMETHODCALLTYPE *GetTypeInfo )( 
            ITGHashtable * This,
            /* [in] */ UINT iTInfo,
            /* [in] */ LCID lcid,
            /* [out] */ ITypeInfo **ppTInfo);
        
        HRESULT ( STDMETHODCALLTYPE *GetIDsOfNames )( 
            ITGHashtable * This,
            /* [in] */ REFIID riid,
            /* [size_is][in] */ LPOLESTR *rgszNames,
            /* [in] */ UINT cNames,
            /* [in] */ LCID lcid,
            /* [size_is][out] */ DISPID *rgDispId);
        
        /* [local] */ HRESULT ( STDMETHODCALLTYPE *Invoke )( 
            ITGHashtable * This,
            /* [in] */ DISPID dispIdMember,
            /* [in] */ REFIID riid,
            /* [in] */ LCID lcid,
            /* [in] */ WORD wFlags,
            /* [out][in] */ DISPPARAMS *pDispParams,
            /* [out] */ VARIANT *pVarResult,
            /* [out] */ EXCEPINFO *pExcepInfo,
            /* [out] */ UINT *puArgErr);
        
        /* [helpstring][id][propget] */ HRESULT ( STDMETHODCALLTYPE *get_InnerHashtable )( 
            ITGHashtable * This,
            /* [retval][out] */ /* external definition not present */ _Hashtable **pVal);
        
        /* [helpstring][id][propput] */ HRESULT ( STDMETHODCALLTYPE *put_InnerHashtable )( 
            ITGHashtable * This,
            /* [in] */ /* external definition not present */ _Hashtable *newVal);
        
        /* [helpstring][id][propget] */ HRESULT ( STDMETHODCALLTYPE *get_Count )( 
            ITGHashtable * This,
            /* [retval][out] */ long *pVal);
        
        /* [helpstring][id][propget] */ HRESULT ( STDMETHODCALLTYPE *get_Values )( 
            ITGHashtable * This,
            /* [retval][out] */ /* external definition not present */ ICollection **pVal);
        
        /* [helpstring][id][propget] */ HRESULT ( STDMETHODCALLTYPE *get_Keys )( 
            ITGHashtable * This,
            /* [retval][out] */ /* external definition not present */ ICollection **pVal);
        
        /* [helpstring][id][propget] */ HRESULT ( STDMETHODCALLTYPE *get_Item )( 
            ITGHashtable * This,
            /* [in] */ VARIANT key,
            /* [retval][out] */ VARIANT *pVal);
        
        /* [helpstring][id][propputref] */ HRESULT ( STDMETHODCALLTYPE *putref_Item )( 
            ITGHashtable * This,
            /* [in] */ VARIANT key,
            /* [in] */ VARIANT pVal);
        
        HRESULT ( STDMETHODCALLTYPE *Contains )( 
            ITGHashtable * This,
            VARIANT key,
            /* [retval][out] */ VARIANT_BOOL *pRetVal);
        
        HRESULT ( STDMETHODCALLTYPE *Add )( 
            ITGHashtable * This,
            VARIANT key,
            VARIANT value);
        
        HRESULT ( STDMETHODCALLTYPE *Clear )( 
            ITGHashtable * This);
        
        HRESULT ( STDMETHODCALLTYPE *Remove )( 
            ITGHashtable * This,
            VARIANT key);
        
        HRESULT ( STDMETHODCALLTYPE *GetEnumerator )( 
            ITGHashtable * This,
            /* [retval][out] */ /* external definition not present */ IDictionaryEnumerator **pRetVal);
        
        END_INTERFACE
    } ITGHashtableVtbl;

    interface ITGHashtable
    {
        CONST_VTBL struct ITGHashtableVtbl *lpVtbl;
    };

    

#ifdef COBJMACROS


#define ITGHashtable_QueryInterface(This,riid,ppvObject)	\
    (This)->lpVtbl -> QueryInterface(This,riid,ppvObject)

#define ITGHashtable_AddRef(This)	\
    (This)->lpVtbl -> AddRef(This)

#define ITGHashtable_Release(This)	\
    (This)->lpVtbl -> Release(This)


#define ITGHashtable_GetTypeInfoCount(This,pctinfo)	\
    (This)->lpVtbl -> GetTypeInfoCount(This,pctinfo)

#define ITGHashtable_GetTypeInfo(This,iTInfo,lcid,ppTInfo)	\
    (This)->lpVtbl -> GetTypeInfo(This,iTInfo,lcid,ppTInfo)

#define ITGHashtable_GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId)	\
    (This)->lpVtbl -> GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId)

#define ITGHashtable_Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr)	\
    (This)->lpVtbl -> Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr)


#define ITGHashtable_get_InnerHashtable(This,pVal)	\
    (This)->lpVtbl -> get_InnerHashtable(This,pVal)

#define ITGHashtable_put_InnerHashtable(This,newVal)	\
    (This)->lpVtbl -> put_InnerHashtable(This,newVal)

#define ITGHashtable_get_Count(This,pVal)	\
    (This)->lpVtbl -> get_Count(This,pVal)

#define ITGHashtable_get_Values(This,pVal)	\
    (This)->lpVtbl -> get_Values(This,pVal)

#define ITGHashtable_get_Keys(This,pVal)	\
    (This)->lpVtbl -> get_Keys(This,pVal)

#define ITGHashtable_get_Item(This,key,pVal)	\
    (This)->lpVtbl -> get_Item(This,key,pVal)

#define ITGHashtable_putref_Item(This,key,pVal)	\
    (This)->lpVtbl -> putref_Item(This,key,pVal)

#define ITGHashtable_Contains(This,key,pRetVal)	\
    (This)->lpVtbl -> Contains(This,key,pRetVal)

#define ITGHashtable_Add(This,key,value)	\
    (This)->lpVtbl -> Add(This,key,value)

#define ITGHashtable_Clear(This)	\
    (This)->lpVtbl -> Clear(This)

#define ITGHashtable_Remove(This,key)	\
    (This)->lpVtbl -> Remove(This,key)

#define ITGHashtable_GetEnumerator(This,pRetVal)	\
    (This)->lpVtbl -> GetEnumerator(This,pRetVal)

#endif /* COBJMACROS */


#endif 	/* C style interface */



/* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE ITGHashtable_get_InnerHashtable_Proxy( 
    ITGHashtable * This,
    /* [retval][out] */ /* external definition not present */ _Hashtable **pVal);


void __RPC_STUB ITGHashtable_get_InnerHashtable_Stub(
    IRpcStubBuffer *This,
    IRpcChannelBuffer *_pRpcChannelBuffer,
    PRPC_MESSAGE _pRpcMessage,
    DWORD *_pdwStubPhase);


/* [helpstring][id][propput] */ HRESULT STDMETHODCALLTYPE ITGHashtable_put_InnerHashtable_Proxy( 
    ITGHashtable * This,
    /* [in] */ /* external definition not present */ _Hashtable *newVal);


void __RPC_STUB ITGHashtable_put_InnerHashtable_Stub(
    IRpcStubBuffer *This,
    IRpcChannelBuffer *_pRpcChannelBuffer,
    PRPC_MESSAGE _pRpcMessage,
    DWORD *_pdwStubPhase);


/* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE ITGHashtable_get_Count_Proxy( 
    ITGHashtable * This,
    /* [retval][out] */ long *pVal);


void __RPC_STUB ITGHashtable_get_Count_Stub(
    IRpcStubBuffer *This,
    IRpcChannelBuffer *_pRpcChannelBuffer,
    PRPC_MESSAGE _pRpcMessage,
    DWORD *_pdwStubPhase);


/* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE ITGHashtable_get_Values_Proxy( 
    ITGHashtable * This,
    /* [retval][out] */ /* external definition not present */ ICollection **pVal);


void __RPC_STUB ITGHashtable_get_Values_Stub(
    IRpcStubBuffer *This,
    IRpcChannelBuffer *_pRpcChannelBuffer,
    PRPC_MESSAGE _pRpcMessage,
    DWORD *_pdwStubPhase);


/* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE ITGHashtable_get_Keys_Proxy( 
    ITGHashtable * This,
    /* [retval][out] */ /* external definition not present */ ICollection **pVal);


void __RPC_STUB ITGHashtable_get_Keys_Stub(
    IRpcStubBuffer *This,
    IRpcChannelBuffer *_pRpcChannelBuffer,
    PRPC_MESSAGE _pRpcMessage,
    DWORD *_pdwStubPhase);


/* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE ITGHashtable_get_Item_Proxy( 
    ITGHashtable * This,
    /* [in] */ VARIANT key,
    /* [retval][out] */ VARIANT *pVal);


void __RPC_STUB ITGHashtable_get_Item_Stub(
    IRpcStubBuffer *This,
    IRpcChannelBuffer *_pRpcChannelBuffer,
    PRPC_MESSAGE _pRpcMessage,
    DWORD *_pdwStubPhase);


/* [helpstring][id][propputref] */ HRESULT STDMETHODCALLTYPE ITGHashtable_putref_Item_Proxy( 
    ITGHashtable * This,
    /* [in] */ VARIANT key,
    /* [in] */ VARIANT pVal);


void __RPC_STUB ITGHashtable_putref_Item_Stub(
    IRpcStubBuffer *This,
    IRpcChannelBuffer *_pRpcChannelBuffer,
    PRPC_MESSAGE _pRpcMessage,
    DWORD *_pdwStubPhase);


HRESULT STDMETHODCALLTYPE ITGHashtable_Contains_Proxy( 
    ITGHashtable * This,
    VARIANT key,
    /* [retval][out] */ VARIANT_BOOL *pRetVal);


void __RPC_STUB ITGHashtable_Contains_Stub(
    IRpcStubBuffer *This,
    IRpcChannelBuffer *_pRpcChannelBuffer,
    PRPC_MESSAGE _pRpcMessage,
    DWORD *_pdwStubPhase);


HRESULT STDMETHODCALLTYPE ITGHashtable_Add_Proxy( 
    ITGHashtable * This,
    VARIANT key,
    VARIANT value);


void __RPC_STUB ITGHashtable_Add_Stub(
    IRpcStubBuffer *This,
    IRpcChannelBuffer *_pRpcChannelBuffer,
    PRPC_MESSAGE _pRpcMessage,
    DWORD *_pdwStubPhase);


HRESULT STDMETHODCALLTYPE ITGHashtable_Clear_Proxy( 
    ITGHashtable * This);


void __RPC_STUB ITGHashtable_Clear_Stub(
    IRpcStubBuffer *This,
    IRpcChannelBuffer *_pRpcChannelBuffer,
    PRPC_MESSAGE _pRpcMessage,
    DWORD *_pdwStubPhase);


HRESULT STDMETHODCALLTYPE ITGHashtable_Remove_Proxy( 
    ITGHashtable * This,
    VARIANT key);


void __RPC_STUB ITGHashtable_Remove_Stub(
    IRpcStubBuffer *This,
    IRpcChannelBuffer *_pRpcChannelBuffer,
    PRPC_MESSAGE _pRpcMessage,
    DWORD *_pdwStubPhase);


HRESULT STDMETHODCALLTYPE ITGHashtable_GetEnumerator_Proxy( 
    ITGHashtable * This,
    /* [retval][out] */ /* external definition not present */ IDictionaryEnumerator **pRetVal);


void __RPC_STUB ITGHashtable_GetEnumerator_Stub(
    IRpcStubBuffer *This,
    IRpcChannelBuffer *_pRpcChannelBuffer,
    PRPC_MESSAGE _pRpcMessage,
    DWORD *_pdwStubPhase);



#endif 	/* __ITGHashtable_INTERFACE_DEFINED__ */


EXTERN_C const CLSID CLSID_TGHashtable;

#ifdef __cplusplus

class DECLSPEC_UUID("24F9DF1F-CD91-4D83-938F-F078AEF95DB4")
TGHashtable;
#endif
#endif /* __CustomHashtableLib_LIBRARY_DEFINED__ */

/* Additional Prototypes for ALL interfaces */

/* end of Additional Prototypes */

#ifdef __cplusplus
}
#endif

#endif


By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Founder SpreadTrends.com
United States United States
I've authored many articles that tackle real-world issues to save my peers in the development community valuable time. For example I've written articles that: show how to decode Ogg Vorbis audio files using the .NET Framework; describe best practices for Improving Entity Framework performance; and demonstrate step-by-step how to create a multi-player game.

Comments and Discussions