这篇文章中介绍了如何导出Flash的接口,这篇文章主要介绍一下,Flash的时间的通知,以及如何利用windows的API,进行两个Flash的混合播放!新建一个默认的 win32窗口程序,然后加入后面的头文件,这里主要是加入atl库文件,以及adobe公司的flash的ocx控件。[cpp]
PRE class=cpp name="code">#include
extern CComModule _Module;
#include
#include
#include "flash32_11_7_700_224.tlh"
#include
using namespace std;
using namespace ShockwaveFlashObjects;
CComModule _Module;然后我们建立个Flash事件的处理类:
class FlashSink : public ShockwaveFlashObjects::_IShockwaveFlashEvents
{
public:
LPCONNECTIONPOINT m_ConnectionPoint;
DWORD m_dwCookie;
int m_nRefCount;
public:
FlashSink()
{
m_dwCookie = 0;
m_ConnectionPoint = NULL;
m_nRefCount = 0;
}
virtual ~FlashSink()
{
}
HRESULT Init(CComPtr ptrFlash)
{
HRESULT aResult = NOERROR;
LPCONNECTIONPOINTCONTAINER aConnectionPoint = NULL;
if ((ptrFlash->QueryInterface(IID_IConnectionPointContainer, (void**) &aConnectionPoint) == S_OK) &&
(aConnectionPoint->FindConnectionPoint(__uuidof(ShockwaveFlashObjects::_IShockwaveFlashEvents), &m_ConnectionPoint) == S_OK))
{
IDispatch* aDispatch = NULL;
QueryInterface(__uuidof(IDispatch), (void**) &aDispatch);
if (aDispatch != NULL)
{
aResult = m_ConnectionPoint->Advise((LPUNKNOWN)aDispatch, &m_dwCookie);
aDispatch->Release();
}
}
if (aConnectionPoint != NULL)
aConnectionPoint->Release();
return aResult;
}
HRESULT Shutdown()
{
HRESULT aResult = S_OK;
if (m_ConnectionPoint)
{
if (m_dwCookie)
{
aResult = m_ConnectionPoint->Unadvise(m_dwCookie);
m_dwCookie = 0;
}
m_ConnectionPoint->Release();
m_ConnectionPoint = NULL;
}
return aResult;
}
HRESULT STDMETHODCALLTYPE QueryInterface(REFIID riid, LPVOID* ppv)
{
*ppv = NULL;
if (riid == IID_IUnknown)
{
*ppv = (LPUNKNOWN)this;
AddRef();
return S_OK;
}
else if (riid == IID_IDispatch)
{
*ppv = (IDispatch*)this;
AddRef();
return S_OK;
}
else if (riid == __uuidof(ShockwaveFlashObjects::_IShockwaveFlashEvents))
{
*ppv = (ShockwaveFlashObjects::_IShockwaveFlashEvents*) this;
AddRef();
return S_OK;
}
else
{
return E_NOTIMPL;
}
}
ULONG STDMETHODCALLTYPE AddRef()
{
return ++m_nRefCount;
}
ULONG STDMETHODCA