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

📄 resorgoptionsupdatespage.cpp

📁 一个vc中管理资源文件ID的插件
💻 CPP
字号:
/************************************************************************
 *
 *                 Resource ID Organiser Utility Library
 *
 *       (c) Copyright 2000-2001 by Andy Metcalfe (andy.metcalfe@lineone.net)
 *                         All rights reserved.
 *
 ************************************************************************
 *                                                                       
 *  Filename    : ResOrgOptionsUpdatesPage.cpp
 *
 *  Description : CResOrgOptionsUpdatesPage - property page class
 *
 *  Compiler    : Microsoft Visual C++ 6.0, Service Pack 3 or 4
 *                                                                       
 *  Target                                                               
 *  Environment : Windows 98/NT
 *
 *  NOTE:
 *
 *    This software is provided "as is" free for personal use. All
 *    title and copyrights in and to the software, including but not
 *    limited to any images, text, etc. incorporated into it, are
 *    owned by Andy Metcalfe, except where acknowledged otherwise.
 *
 *    Your may freely to use this code in your own products, PROVIDED
 *    this notice is not removed or modified.
 *
 *
 *    Visit http://www.resorg.co.uk for latest updates
 *
 ************************************************************************
 *
 *   MODIFICATION HISTORY:
 *
 *           This is a controlled document. See project configuration
 *           control tool for latest version and full version history.
 *
 *    $Archive: /Projects/AddIns/ResOrg/ResOrgUtils/ResOrgOptionsUpdatesPage.cpp $
 *   $Revision: 4 $
 *       $Date: 2/07/01 22:08 $
 *     $Author: Andy $
 *
 *    $History: ResOrgOptionsUpdatesPage.cpp $
 * 
 * *****************  Version 4  *****************
 * User: Andy         Date: 2/07/01    Time: 22:08
 * Updated in $/Projects/AddIns/ResOrg/ResOrgUtils
 * Added a timer to enable the "Check Now" button once an automatic
 * version check completes
 * 
 * *****************  Version 3  *****************
 * User: Andy         Date: 22/05/01   Time: 16:02
 * Updated in $/Projects/AddIns/ResOrg/ResOrgUtils
 * Disable the property sheet whilst checking for new versions
 * 
 * *****************  Version 2  *****************
 * User: Andy         Date: 22/05/01   Time: 6:45
 * Updated in $/Projects/AddIns/ResOrg/ResOrgUtils
 * OnClickedCheckVersionNow() now displays a message box if the version
 * checker fails to connect to the server
 * 
 * *****************  Version 1  *****************
 * User: Andy         Date: 16/05/01   Time: 20:55
 * Created in $/Projects/AddIns/ResOrg/ResOrgUtils
 * 
 *
 * $Nokeywords: $
 *
 ************************************************************************/

// ResOrgOptionsUpdatesPage.cpp : implementation file
//

#include "StdAfx.h"
#include "ResOrgUtils_Priv.h"

#include "ResOrgVersionCheck.h"
#include "ResOrgVersionUpdatedDlg.h"

#include "ResOrgOptionsUpdatesPage.h"


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

/////////////////////////////////////////////////////////////////////////////
// CResOrgOptionsUpdatesPage property page

IMPLEMENT_DYNCREATE(CResOrgOptionsUpdatesPage, CResOrgOptionsUpdatesPage_BASE)

CResOrgOptionsUpdatesPage::CResOrgOptionsUpdatesPage(void)
	: CResOrgOptionsUpdatesPage_BASE(CResOrgOptionsUpdatesPage::IDD)
{
	//{{AFX_DATA_INIT(CResOrgOptionsUpdatesPage)
	m_bEnableVersionCheck	= FALSE;
	m_nVersionCheckInterval	= 0;
	//}}AFX_DATA_INIT

	m_nTimerID				= 0;

	AfxInitRichEdit();		// Just in case nobody else has...
}


CResOrgOptionsUpdatesPage::~CResOrgOptionsUpdatesPage(void)
{
}


void CResOrgOptionsUpdatesPage::DoDataExchange(CDataExchange* pDX)
{
	CResOrgOptionsUpdatesPage_BASE::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(CResOrgOptionsUpdatesPage)
	DDX_Control(pDX,	IDC_RESORG_VERSION_CHECK_CAPTION,	m_ctrlVersionCheckDetails);
	DDX_Check(pDX,		IDC_RESORG_VERSION_CHECK,			m_bEnableVersionCheck);
	DDX_Text(pDX,		IDC_RESORG_VERSION_CHECK_INTERVAL,	m_nVersionCheckInterval);
	DDV_MinMaxInt(pDX,										m_nVersionCheckInterval, 0, 90);
	//}}AFX_DATA_MAP
}


BEGIN_MESSAGE_MAP(CResOrgOptionsUpdatesPage, CResOrgOptionsUpdatesPage_BASE)
	//{{AFX_MSG_MAP(CResOrgOptionsUpdatesPage)
	ON_COMMAND(			IDC_RESORG_VERSION_CHECK,			OnCmdEnableVersionCheck)
	ON_BN_CLICKED(		IDC_RESORG_VERSION_CHECK_NOW,		OnClickedCheckVersionNow)
	ON_WM_TIMER()
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()


/////////////////////////////////////////////////////////////////////////////
// CResOrgOptionsUpdatesPage virtual overrides

BOOL CResOrgOptionsUpdatesPage::OnInitDialog(void) 
{
	CResOrgOptionsUpdatesPage_BASE::OnInitDialog();
	
	// Set the background colour of the rich edit control to the
	// same as the dialog, so nobody realises what it really is....
	m_ctrlVersionCheckDetails.SetBackgroundColor(FALSE, ::GetSysColor(COLOR_3DFACE) );
	m_ctrlVersionCheckDetails.SetFont( GetFont() );
	m_ctrlVersionCheckDetails.SetRTF( ::LoadRtfString(IDS_RESORG_UPDATE_CAPTION) );

	if (Options.IsVersionCheckRunning() )
	{
		// If the version check is already running, we need to wait until
		// it's finished before enabling this control
		EnableDlgControl(IDC_RESORG_VERSION_CHECK_NOW,		FALSE);

		m_nTimerID = SetTimer(1, 500, NULL);
	}

	OnCmdEnableVersionCheck();

	return TRUE;  // return TRUE unless you set the focus to a control
	              // EXCEPTION: OCX Property Pages should return FALSE
}


////////////////////////////////////////////////////////////////////////////
// CResOrgOptionsUpdatesPage message handlers

void CResOrgOptionsUpdatesPage::OnCmdEnableVersionCheck(void)
{
	EnableDlgControl(IDC_RESORG_VERSION_CHECK_INTERVAL, m_bEnableVersionCheck);
}


void CResOrgOptionsUpdatesPage::OnClickedCheckVersionNow(void)
{
	if (!Options.IsVersionCheckRunning() )
	{
		CResOrgVersionCheck* pVersionChecker = Options.StartVersionCheck(FALSE);
		ASSERT(NULL != pVersionChecker);
		if (NULL != pVersionChecker)
		{
			DWORD dwStartAt = ::GetTickCount();

			// Disable the property sheet
			GetParent()->EnableWindow(FALSE);

			// AJM 27.6.2001 for some reason TWO CWaitCursors
			// are needed to prevent flickering!!!
			CWaitCursor wait;
			while (pVersionChecker->IsDownloading() && (::GetTickCount() - dwStartAt <= 60000) )
			{
				CWaitCursor wait;
				MSG msg;
				while (::PeekMessage(	&msg,
										NULL, 
										NULL,
										NULL,
										PM_NOREMOVE))
				{
					if (WM_SETCURSOR != LOWORD(msg.message) )
					{
						AfxGetThread()->PumpMessage();
					}
				}
				// Now let MFC do its idle processing...
				LONG lIdle = 0;
				while ( AfxGetApp()->OnIdle(lIdle++) ) {}
			}
			GetParent()->EnableWindow(TRUE);

			DWORD dwErrorCode = Options.GetVersionChecker()->GetErrorCode();
			
			Options.OnVersionCheckCompleted(TRUE);

			if (ERROR_SUCCESS != dwErrorCode)
			{
				AfxMessageBox( _T("The version information could not be read from the server"),
								MB_OK | MB_ICONEXCLAMATION);
			}
		}
	}
}


void CResOrgOptionsUpdatesPage::OnTimer(UINT nIDEvent) 
{
	if (!Options.IsVersionCheckRunning() )
	{
		// If the version check is already running, we need to wait until
		// it's finished before enabling this control
		EnableDlgControl(IDC_RESORG_VERSION_CHECK_NOW,		TRUE);

		KillTimer(m_nTimerID);
	}
	CResOrgOptionsUpdatesPage_BASE::OnTimer(nIDEvent);
}

⌨️ 快捷键说明

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