httpexview.cpp

来自「INTERNET网络高级编程的包括邮件加密、MAPI、ISAPI、ACTIVEX」· C++ 代码 · 共 120 行

CPP
120
字号
// HttpExView.cpp : implementation of the CHttpExView class
//

#include "stdafx.h"
#include "HttpEx.h"

#include "HttpExDoc.h"
#include "HttpExView.h"

#include "UrlDlg.h"
#include "codedlg.h"

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

/////////////////////////////////////////////////////////////////////////////
// CHttpExView

IMPLEMENT_DYNCREATE(CHttpExView, CHtmlView)

BEGIN_MESSAGE_MAP(CHttpExView, CHtmlView)
	//{{AFX_MSG_MAP(CHttpExView)
	ON_COMMAND(ID_MENU_HTML, OnMenuHtml)
	ON_COMMAND(ID_MENU_CODE, OnMenuCode)
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CHttpExView construction/destruction

CHttpExView::CHttpExView()
{
	// TODO: add construction code here
   m_strUrl=_T("");
}

CHttpExView::~CHttpExView()
{
}

BOOL CHttpExView::PreCreateWindow(CREATESTRUCT& cs)
{
	// TODO: Modify the Window class or styles here by modifying
	//  the CREATESTRUCT cs

	return CHtmlView::PreCreateWindow(cs);
}

/////////////////////////////////////////////////////////////////////////////
// CHttpExView drawing

void CHttpExView::OnDraw(CDC* pDC)
{
	CHttpExDoc* pDoc = GetDocument();
	ASSERT_VALID(pDoc);
	// TODO: add draw code for native data here
	
}

void CHttpExView::OnInitialUpdate()
{
	CHtmlView::OnInitialUpdate();

	// TODO: This code navigates to a popular spot on the web.
	//  change the code to go where you'd like.
	Navigate(_T(""),NULL,NULL);
}

/////////////////////////////////////////////////////////////////////////////
// CHttpExView diagnostics

#ifdef _DEBUG
void CHttpExView::AssertValid() const
{




	CHtmlView::AssertValid();
}

void CHttpExView::Dump(CDumpContext& dc) const
{
	CHtmlView::Dump(dc);
}

CHttpExDoc* CHttpExView::GetDocument() // non-debug version is inline
{
	ASSERT(m_pDocument->IsKindOf(RUNTIME_CLASS(CHttpExDoc)));
	return (CHttpExDoc*)m_pDocument;
}
#endif //_DEBUG

/////////////////////////////////////////////////////////////////////////////
// CHttpExView message handlers

void CHttpExView::OnMenuHtml() 
{
	// TODO: Add your command handler code here
	CUrlDlg urlDlg;
	if(urlDlg.DoModal()==IDOK)
	{
		m_strUrl=urlDlg.GetUrl();
	    Navigate(m_strUrl,NULL,NULL);
	    Invalidate(FALSE);
	}
}

void CHttpExView::OnMenuCode() 
{
	// TODO: Add your command handler code here
	CCodeDlg codeDlg;
	m_strUrl=GetLocationURL(); //得到当前的URL
	codeDlg.SetUrl(m_strUrl);
	codeDlg.DoModal();
}

⌨️ 快捷键说明

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