#include <windows.h>


class CAggrHelloDispatch : public IUnknown
{                                       

	
 public:
 
	IUnknown *m_pUnkOuter ;
	ULONG m_RefCount ;

	class CDelegatingDispatch : public IDispatch
	{
		public:

		IUnknown * m_pGuyToDelegateTo ;
		BSTR m_bstrHelloMsg;

		CDelegatingDispatch ( ) {m_bstrHelloMsg = SysAllocString(L"Hello, world");}		
			STDMETHODIMP QueryInterface (REFIID riid, void FAR* FAR* ppv);
			STDMETHODIMP_(ULONG) AddRef (void);
			STDMETHODIMP_(ULONG) Release (void);
/*
IDispatch methods
*/

			STDMETHODIMP GetTypeInfoCount(UINT *pctinfo) ;
			STDMETHODIMP GetTypeInfo(UINT, LCID, ITypeInfo **pptinfo) ;
			STDMETHODIMP GetIDsOfNames(REFIID, LPOLESTR *, UINT, LCID, DISPID *) ;
			STDMETHODIMP Invoke(DISPID, REFIID, LCID lcid, WORD, DISPPARAMS *,
					VARIANT *, EXCEPINFO *, UINT *) ;


	} 
	m_DelegatingDispatch ;

 /*
 Class constructor
 */
 
    CAggrHelloDispatch(IUnknown *);
    ~CAggrHelloDispatch();

/*
IUnkown methods
*/

	STDMETHODIMP QueryInterface (REFIID riid, void FAR* FAR* ppv);
	STDMETHODIMP_(ULONG) AddRef (void);
	STDMETHODIMP_(ULONG) Release (void);
	                                     
};








