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

📄 resorgcore_globals.cpp

📁 ResOrg 图形化管理Vc项目的资源ID的工具的源代码。 ResOrg - Manage and Renumber Resource Symbol IDs Introduction The
💻 CPP
字号:
/************************************************************************
 *
 *                 Resource ID Organiser Core Library
 *
 * (c) Copyright 2000-2004 by Anna-Jayne Metcalfe (resorg@annasplace.me.uk)
 *                         All rights reserved.
 *
 ************************************************************************
 *                                                                       
 *  Filename    : ResOrgCore_Globals.h
 *
 *  Description : Global methods for the ResOrgCore library
 *                
 *  Compiler    : Microsoft Visual C++ 6.0, Service Pack 3 or later
 *                Microsoft Visual C++ .NET 2003
 *                                                                       
 *  Target                                                               
 *  Environment : Windows 98/NT/2000/XP
 *
 *  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 Anna-Jayne 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.annasplace.me.uk/resorg 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/ResOrgCore/ResOrgCore_Globals.cpp $
 *   $Revision: 1 $
 *       $Date: 29/08/04 21:08 $
 *     $Author: Anna $
 *
 *    $History: ResOrgCore_Globals.cpp $
 * 
 * *****************  Version 1  *****************
 * User: Anna         Date: 29/08/04   Time: 21:08
 * Created in $/Projects/AddIns/ResOrg/ResOrgCore
 * 
 * *****************  Version 12  *****************
 * User: Anna         Date: 24/03/03   Time: 23:39
 * Updated in $/Projects/AddIns/ResOrg/ResOrgCore
 * Added Doxygen mainpage documentation
 * 
 * *****************  Version 11  *****************
 * User: Anna         Date: 2/01/03    Time: 0:08
 * Updated in $/Projects/AddIns/ResOrg/ResOrgCore
 * Updated file banner
 * 
 * *****************  Version 10  *****************
 * User: Anna         Date: 25/11/02   Time: 15:11
 * Updated in $/Projects/AddIns/ResOrg/ResOrgCore
 * Changed website address in banner
 * 
 * *****************  Version 9  *****************
 * User: Anna         Date: 22/10/02   Time: 13:24
 * Updated in $/Projects/AddIns/ResOrg/ResOrgCore
 * Changed name/mail address (at last!)
 * 
 * *****************  Version 8  *****************
 * User: Andy         Date: 10/08/02   Time: 0:14
 * Updated in $/Projects/AddIns/ResOrg/ResOrgCore
 * DoVersionExpiryCheck() now takes a pointer to the parent window as an
 * optional parameter
 * 
 * *****************  Version 7  *****************
 * User: Andy         Date: 7/06/02    Time: 17:04
 * Updated in $/Projects/AddIns/ResOrg/ResOrgCore
 * Renamed the ResOrgUtils module to ResOrgCore. Updated file banners
 * accordingly
 * 
 * *****************  Version 6  *****************
 * User: Andy         Date: 26/05/01   Time: 15:14
 * Updated in $/Projects/AddIns/ResOrg/ResOrgUtils
 * Added Mailing List prompt option
 * 
 * *****************  Version 5  *****************
 * User: Andy         Date: 5/04/01    Time: 6:10
 * Updated in $/Projects/AddIns/ResOrg/ResOrgUtils
 * Added support for version expiry (conditional compilation)
 * 
 * *****************  Version 4  *****************
 * User: Andy         Date: 2/03/01    Time: 13:12
 * Updated in $/Projects/AddIns/ResOrg/ResOrgUtils
 * Added GetSymbolFileName() function [previously in CWorkspaceHelper]
 * 
 * *****************  Version 3  *****************
 * User: Andy         Date: 17/02/01   Time: 7:01
 * Updated in $/Projects/AddIns/ResOrg/ResOrgUtils
 * Added "SymbolTypes" global helper object
 * 
 * *****************  Version 2  *****************
 * User: Andy         Date: 29/11/00   Time: 18:38
 * Updated in $/Projects/AddIns/ResOrg/ResOrgUtils
 *  Added file banners
 *
 * $Nokeywords: $
 *
 ************************************************************************/


#include "stdafx.h"
#include "ResOrgCore_Priv.h"
#include "ResOrgExpiredDlg.h"
#include "ResourceFileBuffer.h"



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


RESORGCORE_EXT_API void DoCommonControlsVersionPrompt(const CString& sVersion)
{
	CNGMessageBox dlg;

	dlg.FormatMsgEx(MAKEINTRESOURCE(IDP_COMCTL32_VER),
					_T("RTF"),
					sVersion);

	dlg.SetRtf();
	dlg.SetStandardIcon(IDI_ERROR);
	dlg.AddButton(IDOK, TRUE, TRUE, _T("OK") );

	dlg.DoModal();
}


RESORGCORE_EXT_API int DoMailingListQuery(void)
{
	CNGMessageBox dlg;

	dlg.SetMsgEx( MAKEINTRESOURCE(	IDP_RESORG_MAILING_LIST),
									_T("RTF") );
	dlg.SetRtf();
	dlg.SetStandardIcon(IDI_INFORMATION);
	dlg.AddButton(IDYES, TRUE, TRUE, _T("&Yes") );
	dlg.AddButton(IDNO, FALSE, FALSE, _T("&No") );

	return dlg.DoModal();
}

#ifdef _RESORG_EXPIRY_DATE

RESORGCORE_EXT_API CTime GetVersionExpiryDate(void)
{
	return CTime(_RESORG_EXPIRY_DATE, 0, 0, 0);
}


RESORGCORE_EXT_API BOOL IsVersionExpired(void)
{
	CTime timeNow		= CTime::GetCurrentTime();
	CTime timeExpires	= GetVersionExpiryDate();

	return (timeNow >= timeExpires);
}


RESORGCORE_EXT_API BOOL DoVersionExpiryCheck(CWnd* pParent /*=NULL*/)
{
	if (::IsVersionExpired() )
	{
		CResOrgExpiredDlg dlg(pParent);

		dlg.DoModal();

        return TRUE;
    }
	return FALSE;
}
#endif


RESORGCORE_EXT_API CString GetSymbolFileName(const CString& sResourceFileName)
{
	CString sSymbolFile;

	// Read the resource file
	CStdioFile f;
	CFileException e;

	if (f.Open(	sResourceFileName,
				CFile::modeRead |
				CFile::shareDenyWrite,
				&e) )
	{
		// File opened OK
		//
		// Now create an archive, and an empty text buffer
		CArchive ar(&f, CArchive::load);
		CResourceFileBuffer buf;
		buf.Serialize(ar);

		// Close the file
		try
		{
			ar.Flush();
			ar.Close();
			f.Flush();
			f.Close();
		}
		catch (CException* e)
		{
			TCHAR szCause[255];
			e->GetErrorMessage(szCause, 255);
			CString sMsg;
			sMsg.Format( _T("The resource file could not be closed: %s\n"), szCause);

			TRACE1("%s\n", sMsg);
			AfxMessageBox(sMsg, MB_OK | MB_ICONSTOP);

			e->Delete();
		}

		CNGSplitPath splitpath(sResourceFileName);

		// Ask the buffer for the name of the symbol file
		sSymbolFile =	splitpath.GetDrive() +
						splitpath.GetDirectory() +
						buf.GetSymbolFileName();
	}
	return sSymbolFile;
}


RESORGCORE_EXT_API UINT DoOverwritePrompt(const CString& sPathName, bool bAllowSaveAs /*= true*/)
{
	CNGSplitPath split(sPathName);
	CString sFileName = split.GetFileName() + split.GetExtension();

	UINT uMsgID = bAllowSaveAs ? IDP_SYM_FILE_OVERWRITE_PROMPT_EX : IDP_SYM_FILE_OVERWRITE_PROMPT;

	CString sMsg;
	sMsg.Format(uMsgID, sFileName, ::AfxGetAppName() );

	CNGMessageBox dlg;

	dlg.SetMsg(sMsg);
	dlg.SetStandardIcon(IDI_EXCLAMATION);
	
	if (bAllowSaveAs)
	{
		dlg.AddButton(IDNO,		false,	false,	_T("&Save As") );
	}
	dlg.AddButton(IDYES,		false,	false,	_T("&Overwrite") );
	dlg.AddButton(IDCANCEL,		true,	true,	_T("Cancel") );

	return dlg.DoModal();
}

⌨️ 快捷键说明

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