Click here to Skip to main content
15,860,943 members
Articles / Desktop Programming / WTL

Form Designer

26 Jul 2021CPOL24 min read 349.8K   82.5K   230  
Component for adding scriptable forms capabilities to an application.
// EventSinkPassThrough.cpp : Implementation of CEventSinkPassThrough
//
// Author : David Shepherd
//			Copyright (c) 2003, DaeDoe-Software
//
/////////////////////////////////////////////////////////////////////////////

#include "stdafx.h"
#include "EventSinkPassThrough.h"

#include "EventSink.h"

/////////////////////////////////////////////////////////////////////////////
// CEventSinkPassThrough

CEventSinkPassThrough::CEventSinkPassThrough()
{
	// initialise everything
	m_pEventSink=NULL;
	m_EventInterfaceGuid=GUID_NULL;
}

CEventSinkPassThrough::~CEventSinkPassThrough()
{
	// clean up
}

HRESULT CEventSinkPassThrough::FinalConstruct()
{
	return S_OK;
}

void CEventSinkPassThrough::FinalRelease()
{
}

HRESULT CEventSinkPassThrough::_QI(void *pv,REFIID riid,LPVOID *ppv,DWORD dw)
{
	// check parameters
	ATLASSERT(pv!=NULL);
	if(ppv==NULL)
	{
		// todo : check this is a valid return value
		return E_POINTER;
	}
	// delegate to the instance version
	return ((CEventSinkPassThrough*)pv)->QI(riid,ppv);
}

HRESULT CEventSinkPassThrough::QI(REFIID riid,LPVOID *ppv)
{
	// handle queries for the event interface
	*ppv=NULL;
	if(riid==m_EventInterfaceGuid)
	{
		*ppv=(IDispatch*)this;
		(void)AddRef();
	}
	return (*ppv!=NULL) ? S_OK : E_NOINTERFACE;
}

STDMETHODIMP CEventSinkPassThrough::GetIDsOfNames(
	REFIID,OLECHAR FAR* FAR*,unsigned int,LCID,DISPID FAR*)
{
	// unexpected
	return E_UNEXPECTED;
	// todo : check this is a valid return value
	// todo : delegate this to the event sink
}

STDMETHODIMP CEventSinkPassThrough::GetTypeInfo(unsigned int,LCID,ITypeInfo FAR* FAR*)
{
	// unexpected
	return E_UNEXPECTED;
	// todo : check this is a valid return value
	// todo : delegate this to the event sink
}

STDMETHODIMP CEventSinkPassThrough::GetTypeInfoCount(unsigned int FAR*)
{
	// unexpected
	return E_UNEXPECTED;
	// todo : check this is a valid return value
	// todo : delegate this to the event sink
}

STDMETHODIMP CEventSinkPassThrough::Invoke(
	DISPID dispIdMember,
	REFIID riid,
	LCID lcid,
	WORD wFlags,
	DISPPARAMS FAR* pDispParams,
	VARIANT FAR* pVarResult,
	EXCEPINFO FAR* pExcepInfo,
	unsigned int FAR* puArgErr)
{
	// delegate to the event sink
	ATLASSERT(m_pEventSink!=NULL);
	return m_pEventSink->Invoke(dispIdMember,
		riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr);
}

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
Web Developer
United Kingdom United Kingdom
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions