checknewversiondlg.cpp

来自「c++系统开发实例精粹内附的80例源代码 环境:windows2000,c++」· C++ 代码 · 共 60 行

CPP
60
字号
//////////////////////////////////////////////////////////////////////
// FileFury
// Copyright (c) 2000 Tenebril Incorporated
// All rights reserved.
//
// This source code is governed by the Tenebril open source
// license (http://www.tenebril.com/developers/opensource/license.html)
//
// For more information on this and other open source applications,
// visit the Tenebril OpenSource page:
//       http://www.tenebril.com/developers/opensource
//
//////////////////////////////////////////////////////////////////////

#include "stdafx.h"
#include "CheckNewVersionDlg.h"

CCheckNewVersionDlg::CCheckNewVersionDlg(CWnd* pParent, LPCTSTR url)
	: CDialog(CCheckNewVersionDlg::IDD, pParent)
{
	URL = url;
}

void CCheckNewVersionDlg::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
}

BEGIN_MESSAGE_MAP(CCheckNewVersionDlg, CDialog)
END_MESSAGE_MAP()

BOOL CCheckNewVersionDlg::OnInitDialog()
{
	CDialog::OnInitDialog();

	// Display the logo.
	CStatic *pGuider;
	CRect crGuider;

	pGuider = (CStatic *)GetDlgItem(IDC_LOGOGUIDER);
	pGuider->GetWindowRect(&crGuider);
	ScreenToClient(&crGuider);

	m_cLogoBox.Create(WS_VISIBLE | WS_CHILD | WS_DISABLED,
		crGuider, this, IDC_LOGOBOX, IDB_UPDATE,
		CSize(52, 40), RGB(191, 191, 191));

	return TRUE;
}

afx_msg void CCheckNewVersionDlg::OnOK()
{
	if(::ShellExecute(this->m_hWnd, "open", URL, NULL, NULL,
		SW_SHOWNORMAL) <= (HINSTANCE)32)
			MessageBox("An error occurred in opening your web browser",
				"New version", MB_ICONSTOP | MB_OK);

	CDialog::OnOK();
}

⌨️ 快捷键说明

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