在网页中加入flash控件,如何映射其事件 ( 积分: 192 )

  • 主题发起人 主题发起人 fensheng106
  • 开始时间 开始时间
F

fensheng106

Unregistered / Unconfirmed
GUEST, unregistred user!
我利用IHTMLObjectElement将flash加入网页中,如何映射其事件。

我用以下函数映射,但始终不正确,请高手指正
void ConnectEvents(IDispatch* pElem)
{
HRESULT hr;
IConnectionPointContainer* pCPC = NULL;
IConnectionPoint* pCP = NULL;
DWORD dwCookie;

// Check that this is a connectable object.
hr = pElem->QueryInterface(IID_IConnectionPointContainer, (void**)&pCPC);

if (SUCCEEDED(hr))
{
// Find the connection point.
hr = pCPC->FindConnectionPoint()
FindConnectionPoint(DIID_HTMLElementEvents2, &pCP);

if (SUCCEEDED(hr))
{
//我跟踪了一下,到这里进不来
// Advise the connection point.
// pUnk is the IUnknown interface pointer for your event sink
hr = pCP->Advise(NULL, &dwCookie);

if (SUCCEEDED(hr))
{
// Successfully advised
}

pCP->Release();
}

pCPC->Release();
}

}
STDMETHODIMP Invoke(
DISPID dispidMember,
REFIID riid,
LCID lcid,
WORD wFlags,
DISPPARAMS* pdispparams,
VARIANT* pvarResult,
EXCEPINFO* pexcepinfo,
UINT* puArgErr)
{
switch ( dispidMember )
{


default:
break;
}
return S_OK;
}

是不是DIID_HTMLElementEvents2这个标志用错了。
 
我利用IHTMLObjectElement将flash加入网页中,如何映射其事件。

我用以下函数映射,但始终不正确,请高手指正
void ConnectEvents(IDispatch* pElem)
{
HRESULT hr;
IConnectionPointContainer* pCPC = NULL;
IConnectionPoint* pCP = NULL;
DWORD dwCookie;

// Check that this is a connectable object.
hr = pElem->QueryInterface(IID_IConnectionPointContainer, (void**)&pCPC);

if (SUCCEEDED(hr))
{
// Find the connection point.
hr = pCPC->FindConnectionPoint()
FindConnectionPoint(DIID_HTMLElementEvents2, &pCP);

if (SUCCEEDED(hr))
{
//我跟踪了一下,到这里进不来
// Advise the connection point.
// pUnk is the IUnknown interface pointer for your event sink
hr = pCP->Advise(NULL, &dwCookie);

if (SUCCEEDED(hr))
{
// Successfully advised
}

pCP->Release();
}

pCPC->Release();
}

}
STDMETHODIMP Invoke(
DISPID dispidMember,
REFIID riid,
LCID lcid,
WORD wFlags,
DISPPARAMS* pdispparams,
VARIANT* pvarResult,
EXCEPINFO* pexcepinfo,
UINT* puArgErr)
{
switch ( dispidMember )
{


default:
break;
}
return S_OK;
}

是不是DIID_HTMLElementEvents2这个标志用错了。
 
我知道了,flash的事件ID为DIID__IShockwaveFlashEvents{D27CDB6D-AE6D-11CF-96B8-444553540000}
但各位大虾,如何实现事件接收类,给个例子
 
后退
顶部