Ejemplo n.º 1
0
STDMETHODIMP CIEControlSite::XDocHostUIHandler::ShowContextMenu(
    DWORD dwID, LPPOINT ppt, LPUNKNOWN pcmdTarget, LPDISPATCH pdispReserved)
{
    METHOD_PROLOGUE_EX_(CIEControlSite, DocHostUIHandler);
    return S_FALSE;

    // 点击右键添加到收藏夹
    HWND hwnd;
    CComPtr<IOleCommandTarget> spCT;
    CComPtr<IOleWindow> spWnd;

    HRESULT hr = pcmdTarget->QueryInterface(IID_IOleCommandTarget, (void**)&spCT);
    if ( FAILED(hr) )
        return S_FALSE;

    hr = pcmdTarget->QueryInterface(IID_IOleWindow, (void**)&spWnd);
    if ( FAILED(hr) )
        return S_FALSE;

    hr = spWnd->GetWindow(&hwnd);

#define ID_IE_ID_ADDFAV 2261
    ::SendMessage(hwnd, WM_COMMAND, MAKEWPARAM(LOWORD(ID_IE_ID_ADDFAV), 0x0), 0 );

    return S_OK;
}
Ejemplo n.º 2
0
STDMETHODIMP CIEControlSite::XDocHostUIHandler::TranslateAccelerator(
	LPMSG lpMsg, const GUID* pguidCmdGroup, DWORD nCmdID)
{
	METHOD_PROLOGUE_EX_(CIEControlSite, DocHostUIHandler);
	HRESULT hr = S_FALSE;

	if ( lpMsg )
	{
		switch ( lpMsg->message )
		{
		case WM_KEYDOWN:
			{
				bool bCtrlPressed = HIBYTE(GetKeyState(VK_CONTROL))!=0;
				bool bAltPressed = HIBYTE(GetKeyState(VK_MENU))!=0;
				bool bShiftPressed = HIBYTE(GetKeyState(VK_SHIFT))!=0;

				// Ctrl-N 会让 IE 自己打开一个 IE 窗口,该窗口无法被我们的处理函数拦截
				// BUG #22839: AltGr + N (也就是 Ctrl-Alt-N)也被拦截了,在这里只拦截 Ctrl-N
				if ( bCtrlPressed && (!bAltPressed) && (!bShiftPressed) && ('N' == lpMsg->wParam) )
				{
					hr = S_OK;
				}

				break;
			}
		}
	}

	return hr;
}
Ejemplo n.º 3
0
STDMETHODIMP CIEControlSite::XOleCommandTarget::Exec(
            /* [unique][in] */ const GUID __RPC_FAR *pguidCmdGroup,
            /* [in] */ DWORD nCmdID,
            /* [in] */ DWORD nCmdexecopt,
            /* [unique][in] */ VARIANT __RPC_FAR *pvaIn,
            /* [unique][out][in] */ VARIANT __RPC_FAR *pvaOut
		   )
{
	METHOD_PROLOGUE_EX_(CIEControlSite, OleCommandTarget);
	if ( pguidCmdGroup && IsEqualGUID(*pguidCmdGroup, CGID_DocHostCommandHandler))
	{
		// 屏蔽脚本错误提示, 已测试IE9
		if (nCmdID == OLECMDID_SHOWSCRIPTERROR)
		{
			// 这里只是简单屏蔽掉
			// 如果要进一步处理, 参考:
			// 《How to handle script errors as a WebBrowser control host》
			// http://support.microsoft.com/default.aspx?scid=kb;en-us;261003

			(*pvaOut).vt = VT_BOOL;
			// Continue running scripts on the page.
			(*pvaOut).boolVal = VARIANT_TRUE;
			return S_OK;

		}
	}
	// 通过脚本关闭IE页面时通知父窗口
	if (nCmdID == OLECMDID_CLOSE) 
	{
		pThis->m_dlg->OnCloseIETab();
	}
	return OLECMDERR_E_NOTSUPPORTED;
}
Ejemplo n.º 4
0
STDMETHODIMP CIEControlSite::XDocHostUIHandler::ShowUI(
	DWORD dwID, LPOLEINPLACEACTIVEOBJECT pActiveObject,
	LPOLECOMMANDTARGET pCommandTarget, LPOLEINPLACEFRAME pFrame,
	LPOLEINPLACEUIWINDOW pDoc)
{
	METHOD_PROLOGUE_EX_(CIEControlSite, DocHostUIHandler);
	return S_FALSE;
}
Ejemplo n.º 5
0
STDMETHODIMP CWebCtrl::DocSite::XDocHostUIHandler::GetExternal(LPDISPATCH *lppDispatch)
{
	METHOD_PROLOGUE_EX_(CWebCtrl::DocSite, DocHostUIHandler)
	CWebCtrl* pCtrl = pThis->GetCtrl();

	*lppDispatch = pCtrl->m_pExternal;
	if ( *lppDispatch != NULL ) (*lppDispatch)->AddRef();

	return ( *lppDispatch != NULL ) ? S_OK : S_FALSE;
}
Ejemplo n.º 6
0
STDMETHODIMP CIEControlSite::XOleCommandTarget::QueryStatus(
            /* [unique][in] */ const GUID __RPC_FAR *pguidCmdGroup,
            /* [in] */ ULONG cCmds,
            /* [out][in][size_is] */ OLECMD __RPC_FAR prgCmds[  ],
            /* [unique][out][in] */ OLECMDTEXT __RPC_FAR *pCmdText
		   )
{
	METHOD_PROLOGUE_EX_(CIEControlSite, OleCommandTarget);
    return OLECMDERR_E_NOTSUPPORTED;
}
Ejemplo n.º 7
0
HRESULT CIEControlSite::XHTMLOMWindowServices::window_call(const char * methodName, LONG x, LONG y)
{
	METHOD_PROLOGUE_EX_(CIEControlSite, HTMLOMWindowServices);

	HRESULT hr = S_FALSE;

	if ( ! pThis->m_dlg ) return S_OK;

	return hr;
}
Ejemplo n.º 8
0
STDMETHODIMP CIEControlSite::XDocHostUIHandler::GetHostInfo(
	DOCHOSTUIINFO *pInfo)
{
	METHOD_PROLOGUE_EX_(CIEControlSite, DocHostUIHandler);

	pInfo->dwFlags = DOCHOSTUIFLAG_NO3DBORDER
		|DOCHOSTUIFLAG_THEME
		|DOCHOSTUIFLAG_ENABLE_FORMS_AUTOCOMPLETE
		|DOCHOSTUIFLAG_LOCAL_MACHINE_ACCESS_CHECK
		|DOCHOSTUIFLAG_CODEPAGELINKEDFONTS;
	pInfo->dwDoubleClick = DOCHOSTUIDBLCLK_DEFAULT;

	return S_OK;
}
Ejemplo n.º 9
0
HRESULT CIEControlSite::XHTMLOMWindowServices::window_call(const char * methodName, LONG x, LONG y)
{
	METHOD_PROLOGUE_EX_(CIEControlSite, HTMLOMWindowServices);

	HRESULT hr = S_FALSE;

	// Suggested by Sonja's boodschappenlijst ([email protected]):
	// Tools -> Options -> Content -> Enable Javascript [Advanced] -> Allow scripts to “Move or resize existing windows”.
	if ( ! pThis->m_dlg ) return S_OK;
/*
	if (nsConfigManager::isClassicMode || m_pParent->m_pPluginInstance->getConfigManager()->getBoolPref("dom.disable_window_move_resize")) return S_OK;

	HRESULT hr = E_FAIL;

	do 
	{
		if ( ! m_pParent ) break;
		if ( ! m_pParent->m_pPluginInstance ) break;

		NPP npp = m_pParent->m_pPluginInstance->instance();

		NPObject * window_object_ = NULL;
		if ( NPN_GetValue(npp, NPNVWindowNPObject, &window_object_) != NPERR_NO_ERROR ) break;

		NPIdentifier id_method = NPN_GetStringIdentifier(methodName);
		if ( !id_method ) break;

		NPVariant pt[2];
		INT32_TO_NPVARIANT(x, pt[0]);
		INT32_TO_NPVARIANT(y, pt[1]);
		NPVariant result;
		NULL_TO_NPVARIANT(result);
		if ( NPN_Invoke(npp, window_object_, id_method, pt, 2, &result) )
		{
			NPN_ReleaseVariantValue(&result);
		}

		hr = S_OK;

	} while(false);
	*/

	return hr;
}
Ejemplo n.º 10
0
STDMETHODIMP COlePropertiesDialog::XOleUIObjInfo::SetViewInfo(
	DWORD dwObject, HGLOBAL hMetaPict, DWORD dvAspect,
	int nCurrentScale, BOOL bRelativeToOrig)
{
	METHOD_PROLOGUE_EX_(COlePropertiesDialog, OleUIObjInfo)
	COleClientItem* pItem = (COleClientItem*)dwObject;
	ASSERT_VALID(pItem);

	// handle aspect changes
	if (dvAspect != -1)
	{
		pItem->OnChange(OLE_CHANGED_ASPECT, dvAspect);
		pItem->SetDrawAspect((DVASPECT)dvAspect);

		// force scale to 100% when changing aspects
		if (dvAspect == DVASPECT_ICON)
		{
			nCurrentScale = 100;
			bRelativeToOrig = TRUE;
		}
		else if (nCurrentScale == -1)
		{
			nCurrentScale = 100;
			bRelativeToOrig = FALSE;
		}
	}

	// handle icon representation changes
	if (hMetaPict != NULL)
	{
		pItem->SetIconicMetafile(hMetaPict);
		if (pItem->GetDrawAspect() == DVASPECT_ICON)
			pItem->OnChange(OLE_CHANGED, (DWORD)DVASPECT_ICON);
	}

	// handle scale changes
	if (nCurrentScale != -1)
	{
		pThis->OnApplyScale(pItem, nCurrentScale, bRelativeToOrig);
	}

	return S_OK;
}
Ejemplo n.º 11
0
STDMETHODIMP CWebCtrl::DocSite::XDocHostUIHandler::ShowContextMenu(DWORD dwID, LPPOINT ppt, LPUNKNOWN pcmdtReserved, LPDISPATCH pdispReserved)
{
	METHOD_PROLOGUE_EX_(CWebCtrl::DocSite, DocHostUIHandler)
	CWebCtrl* pCtrl = pThis->GetCtrl();
	WVNCONTEXTMENU pNotify;

	pNotify.hdr.hwndFrom	= pCtrl->GetSafeHwnd();
	pNotify.hdr.idFrom		= pCtrl->GetDlgCtrlID();
	pNotify.hdr.code		= WVN_CONTEXTMENU;
	pNotify.dwMenuID		= dwID;
	pNotify.ptMouse			= *ppt;
	pNotify.pCmdTarget		= pcmdtReserved;
	pNotify.pContext		= pdispReserved;

	LRESULT lResult = pCtrl->GetOwner()->SendMessage(
		WM_NOTIFY, (WPARAM)pNotify.hdr.idFrom, (LPARAM)&pNotify );

	if ( lResult == 1 ) return S_OK;
	pCtrl->EnterMenu( ppt );

	return S_FALSE;
}
Ejemplo n.º 12
0
HRESULT FAR EXPORT CIEControlSite::XOleCommandTarget::QueryInterface(REFIID riid, void **ppvObj)
{
	METHOD_PROLOGUE_EX_(CIEControlSite, OleCommandTarget);
    HRESULT hr = (HRESULT)pThis->ExternalQueryInterface(&riid, ppvObj);
	return hr;
}
Ejemplo n.º 13
0
STDMETHODIMP CIEControlSite::XDocHostUIHandler::FilterDataObject(
	LPDATAOBJECT pDataObject, LPDATAOBJECT* ppDataObject)
{
	METHOD_PROLOGUE_EX_(CIEControlSite, DocHostUIHandler);
	return S_FALSE;
}
Ejemplo n.º 14
0
STDMETHODIMP CIEControlSite::XDocHostUIHandler::TranslateUrl(
	DWORD dwTranslate, OLECHAR* pchURLIn, OLECHAR** ppchURLOut)
{
	METHOD_PROLOGUE_EX_(CIEControlSite, DocHostUIHandler);
	return S_FALSE;
}
Ejemplo n.º 15
0
STDMETHODIMP CIEControlSite::XDocHostUIHandler::GetDropTarget(
	LPDROPTARGET pDropTarget, LPDROPTARGET* ppDropTarget)
{
	METHOD_PROLOGUE_EX_(CIEControlSite, DocHostUIHandler);
	return S_FALSE;
}
Ejemplo n.º 16
0
STDMETHODIMP CIEControlSite::XDocHostUIHandler::GetOptionKeyPath(
	LPOLESTR* pchKey, DWORD dwReserved)
{
	METHOD_PROLOGUE_EX_(CIEControlSite, DocHostUIHandler);
	return S_FALSE;
}
Ejemplo n.º 17
0
STDMETHODIMP CIEControlSite::XDocHostUIHandler::ShowContextMenu(
	DWORD dwID, LPPOINT ppt, LPUNKNOWN pcmdTarget, LPDISPATCH pdispReserved)
{
	METHOD_PROLOGUE_EX_(CIEControlSite, DocHostUIHandler);
	return S_FALSE;
}
Ejemplo n.º 18
0
ULONG FAR EXPORT CIEControlSite::XHTMLOMWindowServices::Release()
{                            
	METHOD_PROLOGUE_EX_(CIEControlSite, OleCommandTarget);
	return pThis->ExternalRelease();
}
Ejemplo n.º 19
0
STDMETHODIMP CIEControlSite::XDocHostUIHandler::UpdateUI(void)
{
	METHOD_PROLOGUE_EX_(CIEControlSite, DocHostUIHandler);
	return S_OK;
}
Ejemplo n.º 20
0
STDMETHODIMP CIEControlSite::XHTMLOMWindowServices::QueryInterface(
		  REFIID iid, LPVOID far* ppvObj)     
{
	METHOD_PROLOGUE_EX_(CIEControlSite, HTMLOMWindowServices);
	return pThis->ExternalQueryInterface(&iid, ppvObj);
}
Ejemplo n.º 21
0
ULONG FAR EXPORT CIEControlSite::XOleCommandTarget::AddRef()
{
	METHOD_PROLOGUE_EX_(CIEControlSite, OleCommandTarget);
	return pThis->ExternalAddRef();
}
Ejemplo n.º 22
0
STDMETHODIMP_(ULONG) CIEControlSite::XDocHostUIHandler::Release()
{
	METHOD_PROLOGUE_EX_(CIEControlSite, DocHostUIHandler);
	return pThis->ExternalRelease();
}
Ejemplo n.º 23
0
STDMETHODIMP CIEControlSite::XDocHostUIHandler::QueryInterface(
	REFIID iid, LPVOID far* ppvObj)     
{
	METHOD_PROLOGUE_EX_(CIEControlSite, DocHostUIHandler);
	return pThis->ExternalQueryInterface(&iid, ppvObj);
}
Ejemplo n.º 24
0
STDMETHODIMP CIEControlSite::XHTMLOMWindowServices::resizeBy(LONG x, LONG y)
{
	METHOD_PROLOGUE_EX_(CIEControlSite, HTMLOMWindowServices);

	return window_call("resizeBy", x, y);
}
Ejemplo n.º 25
0
STDMETHODIMP CIEControlSite::XDocHostUIHandler::EnableModeless(BOOL fEnable)
{
	METHOD_PROLOGUE_EX_(CIEControlSite, DocHostUIHandler);
	return S_OK;
}
Ejemplo n.º 26
0
STDMETHODIMP CIEControlSite::XDocHostUIHandler::GetExternal(LPDISPATCH *lppDispatch)
{
	METHOD_PROLOGUE_EX_(CIEControlSite, DocHostUIHandler);
	return S_FALSE;
}
Ejemplo n.º 27
0
STDMETHODIMP CIEControlSite::XHTMLOMWindowServices::moveTo(LONG x, LONG y)
{
	METHOD_PROLOGUE_EX_(CIEControlSite, OleCommandTarget);

	return window_call("moveTo", x, y);
}
Ejemplo n.º 28
0
STDMETHODIMP CIEControlSite::XDocHostUIHandler::OnFrameWindowActivate(
	BOOL fActivate)
{
	METHOD_PROLOGUE_EX_(CIEControlSite, DocHostUIHandler);
	return S_OK;
}
Ejemplo n.º 29
0
void COleDispatchImpl::Disconnect()
{
	METHOD_PROLOGUE_EX_(CCmdTarget, Dispatch)

	pThis->ExternalDisconnect();    // always disconnect the object
}
Ejemplo n.º 30
0
STDMETHODIMP CIEControlSite::XDocHostUIHandler::ResizeBorder(
	LPCRECT prcBorder, LPOLEINPLACEUIWINDOW pUIWindow, BOOL fFrameWindow)
{
	METHOD_PROLOGUE_EX_(CIEControlSite, DocHostUIHandler);
	return S_OK;
}