[译]OEM品牌
By robot-v1.0
本文链接 https://www.kyfws.com/applications/oem-branding-zh/
版权声明 本博客所有文章除特别声明外,均采用 BY-NC-SA 许可协议。转载请注明出处!
- 4 分钟阅读 - 1909 个词 阅读量 0[译]OEM品牌
原文地址:https://www.codeproject.com/Articles/16203/OEM-Branding
原文作者:Shaun Harrington
译文由本站 robot-v1.0 翻译
前言
A simple way to produce OEM versions of multi-module products
生产多模块产品OEM版本的简单方法
介绍(Introduction)
我发现OEM’品牌’仍然很麻烦.我需要一种简单的方法来生产多模块产品的OEM版本.图形和图标之类的资源很容易处理,但是(I find that OEM ‘branding’ is still a lot of trouble. I needed a simple way to produce OEM versions of multi-module products. Resources like graphics and icons are easy enough to deal with but the) VERSIONINFO
结构和嵌入式(structures and embedded) string
像"产品名称"一样麻烦.以下是我多年来使用过的一种简单方法,可帮助您简化工作.(s like the ‘product name’ are a hassle. Following is a simple method I have used for years to help ease things.)
此方法使用三个头文件((This method uses three header files ()build.h(build.h),(,)公司(company.h),(,)和product.h(and product.h))和一个称为() and an object called) CBrandingUtils
在中定义(that is defined in)**brandingutils.h(brandingutils.h)**和(and)brandingutils.cpp(brandingutils.cpp).(.)
(build.h)
#define BUILD_NUMBER "1"
(company.h)
#define LEGAL_COPYRIGHT "Copyright © 2006"
#define LEGAL_COMPANY_NAME "PlanetHarrington, Inc."
#define LEGAL_RIGHTS "All rights reserved."
#define LEGAL_FULL_COPYRIGHT "Copyright © 2006 PlanetHarrington, Inc.
All rights reserved."
#define SIMPLE_COMPANY_NAME "PlanetHarrington"
#define COMPANY_CONTACT_URL "http://www.planetharrington.com"
(product.h)
#define PRODUCT_NAME "BrandingDemo"
#define PRODUCT_VERSION "1.0"
#define PRODUCT_TRADEMARKS "BrandingDemo is a trademark of PlanetHarrington."
#define PRODUCT_VSTRUCT_VERSION "1,0,0,0"
#define PRODUCT_VSTRUCT_VERSION_PART1 1
#define PRODUCT_VSTRUCT_VERSION_PART2 0
#define PRODUCT_VSTRUCT_VERSION_PART3 0
#define PRODUCT_VSTRUCT_VERSION_PART4 0
(brandingutils.h)
#pragma once
#include <span class="code-keyword"><string></span>
using namespace std;
#include <span class="code-string">"build.h"</span>
#include <span class="code-string">"company.h"</span>
#include <span class="code-string">"product.h"</span>
/*
* CBrandingUtils provides methods that work in conjunction with the
* definitions from the 'build.h', 'company.h', and 'product.h' files.
*/
class CBrandingUtils
{
public:
CBrandingUtils(){};
virtual ~CBrandingUtils(){};
HRESULT Put_COMPANY_NAME_InControl(HWND, UINT);
HRESULT Put_PRODUCT_NAME_InControl(HWND, UINT);
HRESULT Put_PRODUCT_VERSION_InControl(HWND, UINT);
HRESULT Put_BUILD_NUMBER_InControl(HWND, UINT);
HRESULT Put_COPYRIGHT_InControl(HWND, UINT);
HRESULT Put_COMPANY_CONTACT_URL_InControl(HWND, UINT);
HRESULT Put_RIGHTS_InControl(HWND, UINT);
HRESULT Put_FULL_COPYRIGHT_InControl(HWND, UINT);
HRESULT Put_FULL_COMPANY_NAME_InControl(HWND, UINT);
HRESULT Put_PRODUCT_NAME_InTitle(HWND, bool bPropPage = false);
HRESULT ReplaceStringWithString(wstring&, LPCTSTR, LPCTSTR);
HRESULT ReplaceStringWithStringInCtrl(LPCTSTR, LPCTSTR, HWND, UINT);
};
大多数开发人员都希望修改(Most developers will want to modify the) CBrandingUtils
满足其特定需求的方法和常量.(methods and constants to suit their particular needs.)
使用(Using)
1.与VERSIONINFO资源一起使用(1. Using with a VERSIONINFO Resource)
-
加三个(Add the three)
include
文件到您的项目.(files to your project.) -
添加(Add the)
include
文件到(files to the)*** .rc(**.rc*)**文件:(*file:*) -
移动整个(Move the entire)
VERSIONINFO
的部分(section to the)*** .rc2(**.rc2*)**文件.(*file.*) -
使用所需的宏:(Use the desired macros:)
-
生成后检查结果,方法是使用资源管理器打开交付的"属性"对话框,选择"版本"选项卡,并确认显示的信息正确.(Check the results after building by opening the ‘Properties’ dialog for the deliverable using Explorer, selecting the “Version” tab, and confirming that the information displayed is correct.)
2.在对话框对象中使用代码(2. Using with Code in a Dialog Object)
-
添加(Add the)**brandingutils.h(brandingutils.h)**和(and)**brandingutils.cpp(brandingutils.cpp)**文件到您的项目.关闭CPP的预编译头(files to your project. Turn off precompiled headers for the CPP)****文件.(file.)
-
包括(Include the)**CBrandingUtils.h(CBrandingUtils.h)**源文件中的文件,并声明一个实例(file in your source file and declare an instance of a)
CBrandingUtils
目的.使用三个头文件中的定义以及(object. Use the definitions in the three header files along with the methods in the)CBrandingUtils
将嵌入的关键字替换为所需的文本.(to replace the embedded keywords with the desired text.) -
退房(Check out)**brandingdemDlg.h(brandingdemDlg.h)**和(and)**BrandingdemDlg.cpp(BrandingdemDlg.cpp)**一个完整的例子.(for a complete example.)
示范项目(Demo Project)
演示项目下载包括所有必需的文件和一个Visual Studio 7项目.项目输出都是(The demo project download includes all the required files and a Visual Studio 7 project. The project output is both a)品牌(branded)应用程序和测试工具(application and a test harness for the) CBrandingUtils
目的.运行该应用程序,并记下该应用程序的标题和"关于包装"信息.更改三个头文件中的定义,重新编译,然后再次运行并检查更改.将另一个模块添加到解决方案并在其中实施商标,以查看更改两个模块的版本信息有多么容易.(object. Run the application and note the application title and About Box information. Change the definitions in the three header files, recompile, and run again and check for your changes. Add another module to the solution and implement the branding in it to see how easy it is to change version information for both of the modules.)
概要(Summary)
如果我遗漏了您认为应该在文章中提及的任何细节,请告诉我.(If I left out any details you think should be mentioned in the article, please let me know.)
如果您可以花一秒钟的时间对本文进行评分,甚至发表评论,我们将不胜感激.(If you could take one last second to rate this article or even leave a comment, it would be much appreciated.)
谢谢阅读!(Thanks for reading!)
许可
本文以及所有相关的源代码和文件均已获得The Code Project Open License (CPOL)的许可。
C++ Windows Visual-Studio Dev 新闻 翻译