📄 siteselect.cpp
字号:
// SiteSelect.cpp : implementation file
//
#include "stdafx.h"
#include "DBtest.h"
#include "SiteSelect.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CSiteSelect dialog
CSiteSelect::CSiteSelect(CWnd* pParent /*=NULL*/)
: CDialog(CSiteSelect::IDD, pParent)
{
//{{AFX_DATA_INIT(CSiteSelect)
m_sURL = _T("http://www.microsoft.com");
//}}AFX_DATA_INIT
}
void CSiteSelect::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CSiteSelect)
DDX_Control(pDX, IDC_EDIT3, m_Frame);
DDX_Control(pDX, IDC_EDIT2, m_Anchor);
DDX_Control(pDX, IDC_EDIT1, m_URL);
DDX_Text(pDX, IDC_EDIT1, m_sURL);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CSiteSelect, CDialog)
//{{AFX_MSG_MAP(CSiteSelect)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CSiteSelect message handlers
void CSiteSelect::OnOK() //进入选定一个的WEB站点
{
LPCWSTR pszURL=NULL; //局部URL字符串指针变量
LPCWSTR pszAnchor=NULL; //局部Anchor字符串指针变量
LPCWSTR pszFrame=NULL; //局部Frame字符串指针变量
LPTSTR pszBuffer=""; //缓冲区
//得到统一资源定位地址(URL)<必填>.
if(m_URL.LineLength ()>0) //单行编辑框时LineLength()中参数忽略
{
m_URL.GetLine(0,pszBuffer,m_URL.LineLength());
pszURL=LPCWSTR(pszBuffer);
}
else
{
MessageBox("您必须输入一个URL","错误",MB_OK|MB_ICONERROR);
return;
}
//得到WEB页内的相对位置(Anchor)<选填>.
if(m_Anchor.LineLength()>0)//单行编辑框时LineLength()中参数忽略
{
m_Anchor.GetLine(0,pszBuffer,m_Anchor.LineLength());
pszAnchor=LPCWSTR(pszBuffer);
}
//得到使用WEB的框架,HTML页专用,只对有框架时起作用<选填>.
if(m_Frame.LineLength()>0)//单行编辑框时LineLength()中参数忽略
{
m_Frame.GetLine(0,pszBuffer,m_Frame.LineLength());
pszFrame=LPCWSTR(pszBuffer);
}
//Go right to the selected web page
HlinkSimpleNavigateToString(pszURL,pszAnchor,pszFrame,NULL,0,NULL,NULL,0);
CDialog::OnOK();
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -