⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 ieview.cpp

📁 wince下面
💻 CPP
字号:
// IEView.cpp: implementation of the CIEView class.
//
//////////////////////////////////////////////////////////////////////

#include "stdafx.h"
#include "IEView.h"

#ifdef _DEBUG
#undef THIS_FILE
static char THIS_FILE[]=__FILE__;
#define new DEBUG_NEW
#endif

//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////

CIEView::CIEView()
{
	m_pBrowserApp = NULL;

}

CIEView::~CIEView()
{
	if (m_pBrowserApp != NULL)
            m_pBrowserApp->Release();

}

void CIEView::Nav2URL(LPCTSTR lpszURL)
{
	COleVariant empty;
	CString strURL(lpszURL);
	BSTR bstrURL = strURL.AllocSysString();
	
	m_pBrowserApp->Navigate (bstrURL, COleVariant((long) 0, VT_I4),
		empty, empty, empty);

}

BOOL CIEView::MyInit(CRect rectClient, CWnd*  wndParent)
{
	// create the control window
	// AFX_IDW_PANE_FIRST is a safe but arbitrary ID
	if (!m_wndBrowser.CreateControl(CLSID_WebBrowser, NULL,
		WS_VISIBLE | WS_CHILD & ~WS_BORDER,
		rectClient, wndParent, 
		AFX_IDW_PANE_FIRST))
	{
		return FALSE;
	}
	
	// Get interface pointer
	LPUNKNOWN lpUnk = m_wndBrowser.GetControlUnknown();
	HRESULT hr = lpUnk->QueryInterface(IID_IWebBrowser2, 
		(void**) &m_pBrowserApp);
	if (!SUCCEEDED(hr))
	{
		m_pBrowserApp = NULL;
		m_wndBrowser.DestroyWindow();
		return FALSE;
	}
	return TRUE;
}

void CIEView::Refresh( )
{
	m_pBrowserApp->Refresh();
}

void CIEView::Show(BOOL bShow)
{
	//m_wndBrowser.ShowWindow(SW_HIDE);
	if(bShow)
		::ShowWindow( m_wndBrowser.GetSafeHwnd(), SW_SHOW ); 
	
	else
		::ShowWindow( m_wndBrowser.GetSafeHwnd(), SW_HIDE ); 
	
}

void CIEView::SetRect(CRect rc)
{
	m_wndBrowser.MoveWindow(rc);
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -