IOleClientSite *pSite = NULL;
GetClientSite(&pSite);
if (pSite == NULL)
{
return;
}
CComPtr<IOleContainer> spContainer;
pSite->GetContainer(&spContainer);
if (spContainer == NULL)
{
return;
}
CComQIPtr<IHTMLDocument2> spDoc = spContainer;
if (spDoc == NULL)
{
return;
}
CComPtr<IHTMLWindow2> spWin;
spDoc->get_parentWindow(&spWin);
if (spWin == NULL)
{
return;
}
_variant_t vRet;
_bstr_t strJScript(L"JScript");
CString strCode;
strCode.Format(_T("OnMsg(%d,%s);"), wParam, lParam);
_bstr_t bstrCode(strCode.GetString());
HRESULT hr= spWin->execScript(bstrCode, strJScript, vRet.GetAddress());
posted on 2011-09-27 14:26
张志松 阅读(359)
评论(0) 编辑 收藏 引用 所属分类:
ATL