Click here to Skip to main content
15,885,365 members
Articles / Desktop Programming / WTL

Web Win32/WTL Hybrid

Rate me:
Please Sign up or sign in to vote.
4.83/5 (15 votes)
22 Dec 20054 min read 136.2K   2.1K   50  
How to implement a two-way communication path from IExplorer and WTL code
// WebWin32EventHandler.cpp : Implementation of CWebWin32EventHandler

#include "stdafx.h"
#include "WebWin32EventHandler.h"


// CWebWin32EventHandler

STDMETHODIMP CWebWin32EventHandler::InterfaceSupportsErrorInfo(REFIID riid)
{
	static const IID* arr[] = 
	{
		&IID_IWebWin32EventHandler
	};

	for (int i=0; i < sizeof(arr) / sizeof(arr[0]); i++)
	{
		if (InlineIsEqualGUID(*arr[i],riid))
			return S_OK;
	}
	return S_FALSE;
}

STDMETHODIMP CWebWin32EventHandler::SetHandler(LONG pThis, LONG pMember)
{
	m_pThis   = pThis;
	m_pMember = pMember;
	return S_OK;
}

STDMETHODIMP CWebWin32EventHandler::CallHandler(void)
{
	// a simple __thiscall asm implementation
	DWORD pMember;
	DWORD pThis;
	pThis   = m_pThis;
	pMember = m_pMember;
	BOOL bHandled=false;
	_asm
	{
		lea eax,[bHandled]
		push eax
		mov ecx,[pThis]
		call pMember
	}
	return S_OK;
}

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 has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here


Written By
CEO wave-vs.net
Spain Spain
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions