当前位置: 首页>>代码示例>>C++>>正文


C++ CComQIPtr::GetHTMLWindow方法代码示例

本文整理汇总了C++中CComQIPtr::GetHTMLWindow方法的典型用法代码示例。如果您正苦于以下问题:C++ CComQIPtr::GetHTMLWindow方法的具体用法?C++ CComQIPtr::GetHTMLWindow怎么用?C++ CComQIPtr::GetHTMLWindow使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CComQIPtr的用法示例。


在下文中一共展示了CComQIPtr::GetHTMLWindow方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: handleDeactivateObjectEvent

STDMETHODIMP CWENavigatorDlg::handleDeactivateObjectEvent(IUnknown* object, long cookie, BOOL* bAllow)
{
	ATLASSERT(m_layoutView != NULL);

	CEXMLLayoutView* layoutView = static_cast<CEXMLLayoutView*>(m_layoutView.p);
	CComQIPtr<ILHTMLActiveView> htmlview = layoutView->m_pIOleDocView;
	CComPtr<ILHTMLWindow> window;
	htmlview->GetHTMLWindow(&window);

	CComPtr<IEXMLDocument> eDocument = layoutView->m_document;
	IDispEventImpl<2, CWENavigatorDlg, &DIID__IEXMLDocumentEvents, &LIBID_LXMLEDITORLib, 1, 0>::DispEventUnadvise(eDocument);

	IDispEventImpl<4, CWENavigatorDlg, &DIID__ILHTMLWindowEvents, &LIBID_LHTMLLib, 1, 0>::DispEventUnadvise(window);

	m_layoutView.Release();

	m_cnedit.ShowWindow(SW_HIDE);

	if (m_hWnd)
	{
		OnSize();
		InvalidateRect(NULL, TRUE);
	}

	return S_OK;
}
开发者ID:,项目名称:,代码行数:26,代码来源:

示例2: OnChangeViewBox

void CWENavigatorDlg::OnChangeViewBox()
{
	ATLASSERT(0);
#if 0
	if (m_hWnd)
	{
		if (m_layoutView)
		{
			CEXMLLayoutView* layoutView = static_cast<CEXMLLayoutView*>(m_layoutView.p);
			CComQIPtr<ILHTMLActiveView> htmlview = layoutView->m_pIOleDocView;
			CComPtr<ILHTMLWindow> window;
			htmlview->GetHTMLWindow(&window);

			double magnify;
			window->get_magnify(&magnify);

			TCHAR buf[32];
			sprintf(buf, "%g%%", magnify*100);
			m_cnedit.SetWindowText(buf);
		}
	}

	if (m_hWnd)
	{
		OnSize();
		InvalidateRect(NULL, TRUE);
	}
#endif
}
开发者ID:,项目名称:,代码行数:29,代码来源:

示例3: handleActivateObjectEvent

// IUIEventHandler
STDMETHODIMP CWENavigatorDlg::handleActivateObjectEvent(IUnknown* object, long* cookie)
{
	CComQIPtr<IEXMLLayoutView> view = object;
	if (view)
	{
		ATLASSERT(m_layoutView == NULL);
		m_layoutView = view;

		CEXMLLayoutView* layoutView = static_cast<CEXMLLayoutView*>(m_layoutView.p);
		CComQIPtr<ILHTMLActiveView> htmlview = layoutView->m_pIOleDocView;
		if (htmlview)
		{
			CComPtr<ILHTMLWindow> window;
			htmlview->GetHTMLWindow(&window);
			if (window)
			{
				CComPtr<IEXMLDocument> eDocument = layoutView->m_document;
				IDispEventImpl<2, CWENavigatorDlg, &DIID__IEXMLDocumentEvents, &LIBID_LXMLEDITORLib, 1, 0>::DispEventAdvise(eDocument);

				IDispEventImpl<4, CWENavigatorDlg, &DIID__ILHTMLWindowEvents, &LIBID_LHTMLLib, 1, 0>::DispEventAdvise(window);

				OnChangeViewBox();

				m_cnedit.ShowWindow(SW_SHOW);

				*cookie = 1;
			}
		}
	}

	return S_OK;
}
开发者ID:,项目名称:,代码行数:33,代码来源:

示例4: OnActivate

STDMETHODIMP CWENavigatorDlg::OnActivate(BOOL bActivate, IUIDlg* pActivateView, IUIDlg* pDeactivateView)
{
	CEXMLLayoutView* layoutView = static_cast<CEXMLLayoutView*>(m_layoutView.p);

	if (bActivate)
	{
		CComQIPtr<ILHTMLActiveView> htmlview = layoutView->m_pIOleDocView;
		CComPtr<ILHTMLWindow> window;
		htmlview->GetHTMLWindow(&window);
		IDispEventImpl<4, CWENavigatorDlg, &DIID__ILHTMLWindowEvents, &LIBID_LHTMLLib, 1, 0>::DispEventAdvise(window);

		OnChangeViewBox();
	}
	else
	{
		CComQIPtr<ILHTMLActiveView> htmlview = layoutView->m_pIOleDocView;
		CComPtr<ILHTMLWindow> window;
		htmlview->GetHTMLWindow(&window);
		IDispEventImpl<4, CWENavigatorDlg, &DIID__ILHTMLWindowEvents, &LIBID_LHTMLLib, 1, 0>::DispEventUnadvise(window);
	}

	return S_OK;
}
开发者ID:,项目名称:,代码行数:23,代码来源:

示例5: OnEditKeydown

LRESULT CWENavigatorDlg::OnEditKeydown(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
{
	ATLASSERT(0);
#if 0
	if ((uMsg == WM_KILLFOCUS) ||
		(uMsg == WM_KEYDOWN && wParam == VK_RETURN))
	{
		if (m_layoutView)
		{
			TCHAR buf[64];
			m_cnedit.GetWindowText(buf, sizeof(buf));

			double newscale = atof(buf) / 100;

			CEXMLLayoutView* layoutView = static_cast<CEXMLLayoutView*>(m_layoutView.p);
			CComQIPtr<ILHTMLActiveView> htmlview = layoutView->m_pIOleDocView;
			CComPtr<ILHTMLWindow> window;
			htmlview->GetHTMLWindow(&window);

			long innerWidth;
			long innerHeight;
			window->get_innerWidth(&innerWidth);
			window->get_innerHeight(&innerHeight);

			double oldscale;
			window->get_magnify(&oldscale);

			window->ZoomToRect(
				innerWidth/2 - innerWidth*oldscale/newscale/2,
				innerHeight/2 - innerHeight*oldscale/newscale/2,
				innerWidth*oldscale/newscale,
				innerHeight*oldscale/newscale,
				VARIANT_TRUE);
		}

		if (uMsg == WM_KEYDOWN)
			return 0;
	}

	return m_cnedit.DefWindowProc(uMsg, wParam, lParam);
#endif
	return 0;
}
开发者ID:,项目名称:,代码行数:43,代码来源:

示例6: OnSize

void CWENavigatorDlg::OnSize()
{
	ATLASSERT(0);
#if 0
	CRect client;
	GetClientRect(&client);

	client.right -= 6;
	client.bottom -= 6+16;

	m_size.cx = 0;
	m_size.cy = 0;

	CEXMLLayoutView* layoutView = static_cast<CEXMLLayoutView*>(m_layoutView.p);

	ATLASSERT(layoutView->m_hWnd);
	if (layoutView->m_hWnd)	// hm.. layoutview isn't activated yet?
	{
		CComQIPtr<ILHTMLActiveView> htmlview = layoutView->m_pIOleDocView;
		CComPtr<ILHTMLWindow> window;
		htmlview->GetHTMLWindow(&window);

		double docwidth;
		double docheight;
		window->get_contentWidth(&docwidth);
		window->get_contentHeight(&docheight);

		int fullwidth = docwidth+200;
		int fullheight = docheight+200;

		m_size.cx = client.Width();
		m_size.cy = (m_size.cx*fullheight)/fullwidth;

		if (m_size.cy > client.Height())
		{
			m_size.cy = client.Height();
			m_size.cx = (m_size.cy*fullwidth)/fullheight;
		}

		m_magnify = (double)m_size.cx/fullwidth;
	}
#endif
}
开发者ID:,项目名称:,代码行数:43,代码来源:

示例7: OnMouseMove

LRESULT CWENavigatorDlg::OnMouseMove(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
{
	ATLASSERT(0);
#if 0
	POINT point;
	point.x = (short)LOWORD(lParam);
	point.y = (short)HIWORD(lParam);

	CRect client;
	GetClientRect(&client);

	if (m_dragging)
	{
		ATLASSERT(m_layoutView);
		CEXMLLayoutView* layoutView = static_cast<CEXMLLayoutView*>(m_layoutView.p);
		CComQIPtr<ILHTMLActiveView> htmlview = layoutView->m_pIOleDocView;
		CComPtr<ILHTMLWindow> window;
		htmlview->GetHTMLWindow(&window);
		{
			{

				int left = 100*m_magnify + 3 + (client.Width()-6-m_size.cx)/2;
				int top = 100*m_magnify + 3 + (client.Height()-6-16-m_size.cy)/2;

				POINT cpt;
				cpt.x = point.x-left;
				cpt.y = point.y-top;

				double currentScale;
				window->get_magnify(&currentScale);

				int cx = ((cpt.x/m_magnify) - m_offset.x) * currentScale;
				int cy = ((cpt.y/m_magnify) - m_offset.y) * currentScale;

				window->setCurrentTranslate(-cx, -cy);
			}
		}
	}
#endif

	return 0;
}
开发者ID:,项目名称:,代码行数:42,代码来源:

示例8: GetViewBox

CRect CWENavigatorDlg::GetViewBox()
{
	ATLASSERT(0);
#if 0
	if (m_layoutView)
	{
		CEXMLLayoutView* layoutView = static_cast<CEXMLLayoutView*>(m_layoutView.p);
		CComQIPtr<ILHTMLActiveView> htmlview = layoutView->m_pIOleDocView;
		CComPtr<ILHTMLWindow> window;
		htmlview->GetHTMLWindow(&window);

		CRect viewBox;

		double currentTranslateX;
		double currentTranslateY;
		double magnify;
		long innerWidth;
		long innerHeight;

		window->get_currentTranslateX(&currentTranslateX);
		window->get_currentTranslateY(&currentTranslateY);
		window->get_magnify(&magnify);
		window->get_innerWidth(&innerWidth);
		window->get_innerHeight(&innerHeight);

		viewBox.left = -currentTranslateX/magnify;
		viewBox.top = -currentTranslateY/magnify;
		viewBox.right = -currentTranslateX/magnify + innerWidth/magnify;
		viewBox.bottom = -currentTranslateY/magnify + innerHeight/magnify;

		return viewBox;
	}
#endif

	return CRect(0,0,0,0);
}
开发者ID:,项目名称:,代码行数:36,代码来源:

示例9: OnLButtonDown

LRESULT CWENavigatorDlg::OnLButtonDown(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
{
	ATLASSERT(0);
#if 0
	POINT point;
	point.x = (short)LOWORD(lParam);
	point.y = (short)HIWORD(lParam);

	CRect client;
	GetClientRect(&client);

	if (!m_dragging)
	{
		if (m_layoutView)
		{
			CEXMLLayoutView* layoutView = static_cast<CEXMLLayoutView*>(m_layoutView.p);
			CComQIPtr<ILHTMLActiveView> htmlview = layoutView->m_pIOleDocView;
			CComPtr<ILHTMLWindow> window;
			htmlview->GetHTMLWindow(&window);

		//	if (svgdoc)
			{
				int left = 100*m_magnify + 3 + (client.Width()-6-m_size.cx)/2;
				int top = 100*m_magnify + 3 + (client.Height()-6-16-m_size.cy)/2;
			//	int left = 200*m_magnify + 3 + (client.Width()-6-m_size.cx)/2;
			//	int top = 50*m_magnify + 3 + (client.Height()-6-m_size.cy)/2;

				POINT cpt;
				cpt.x = point.x-left;
				cpt.y = point.y-top;

				CRect viewBox = GetViewBox();

				CRect viewRect = viewBox;

				viewRect.left *= m_magnify;
				viewRect.top *= m_magnify;
				viewRect.right *= m_magnify;
				viewRect.bottom *= m_magnify;

				if (PtInRect(&viewRect, cpt))
				{
					m_offset.x = (cpt.x/m_magnify) - viewBox.left;
					m_offset.y = (cpt.y/m_magnify) - viewBox.top;
				}
				else
				{
					m_offset.x = viewBox.Width()/2;
					m_offset.y = viewBox.Height()/2;

					double currentScale;
					window->get_magnify(&currentScale);

					int cx = ((cpt.x/m_magnify) - m_offset.x) * currentScale;
					int cy = ((cpt.y/m_magnify) - m_offset.y) * currentScale;

					window->setCurrentTranslate(-cx, -cy);
				}

				SetCursor(LoadCursor(_Module.GetResourceInstance(), MAKEINTRESOURCE(IDC_HAND2)));

				m_dragging = TRUE;
				SetCapture();
			}
		}
	}
#endif

	return 0;
}
开发者ID:,项目名称:,代码行数:70,代码来源:

示例10: OnPaint

LRESULT CWENavigatorDlg::OnPaint(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
{
	ATLASSERT(0);
#if 0
	CPaintDC dc(m_hWnd);
//	HDC hDC = dc.m_hDC;

	CRect client;
	GetClientRect(&client);

	if (m_layoutView)
	{
		/*
		CComQIPtr<IWebXMLDocument> esvgDocument;
		m_layoutView->get_ESvgDocument(&esvgDocument);
		*/

		CEXMLLayoutView* layoutView = static_cast<CEXMLLayoutView*>(m_layoutView.p);
		CComQIPtr<ILHTMLActiveView> htmlview = layoutView->m_pIOleDocView;
		if (htmlview)
		{
			CComPtr<ILHTMLWindow> window;
			htmlview->GetHTMLWindow(&window);

			CEXMLDocument* pDocument = static_cast<CEXMLDocument*>(layoutView->m_viewGroup->m_pDocument);

			CComPtr<ILDOMDocument> doc;
			pDocument->get_DOMDocument(&doc);

			LSVG::SVGDocument* svgdoc = doc;

			if (svgdoc)
			{
				CComQIPtr<ILSVGSVGElement> svg;
				svgdoc->get_documentElement((ILDOMElement**)&svg);
				if (svg)
				{
					int state = dc.SaveDC();

					double docwidth;
					double docheight;
					window->get_contentWidth(&docwidth);//= pDocument->GetWidth();
					window->get_contentHeight(&docheight);//= pDocument->GetHeight();

					/*
					int fullwidth = docwidth+400;
					int fullheight = docheight+100;
					*/

					CRect rect;
					rect.left = 3 + (client.Width()-6-m_size.cx)/2;
					rect.top = 3 + (client.Height()-6-16-m_size.cy)/2;
					rect.right = rect.left + m_size.cx;
					rect.bottom = rect.top + m_size.cy;

					CRect brect = rect;

					//FillSolidRect(hDC, &rect, RGB(255, 255, 255));

					brect.InflateRect(1, 1);
					dc.Draw3dRect(&brect, GetSysColor(COLOR_3DSHADOW), GetSysColor(COLOR_3DLIGHT));

					brect.InflateRect(1, 1);
					dc.Draw3dRect(&brect, GetSysColor(COLOR_3DDKSHADOW), GetSysColor(COLOR_3DHILIGHT));

					if (dc.IntersectClipRect(rect.left, rect.top, rect.right, rect.bottom) > NULLREGION)
					{
						if (m_offbm)
						{
							BITMAP bm;
							m_offbm.GetBitmap(&bm);

							if (bm.bmWidth != rect.Width() || bm.bmHeight != rect.Height())
							{
								m_offbm.DeleteObject();
							}
						}

						if (m_offbm == NULL)
						{
							m_offbm.CreateCompatibleBitmap(dc, rect.Width(), rect.Height());
							m_bRedraw = true;
						}


						int x = 100 * m_magnify;
						int y = 100 * m_magnify;

						if (m_bRedraw)
						{
							CDC dc2;
							dc2.CreateCompatibleDC(dc);
							HBITMAP hOldBitmap = (HBITMAP)dc2.SelectBitmap(m_offbm);

							dc2.FillSolidRect(0, 0, rect.Width(), rect.Height(), RGB(255, 255, 255));

							CPoint oldOrg = dc2.SetViewportOrg(x, y);

							CRect prect(0, 0, docwidth*m_magnify, docheight*m_magnify);

//.........这里部分代码省略.........
开发者ID:,项目名称:,代码行数:101,代码来源:


注:本文中的CComQIPtr::GetHTMLWindow方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。