问题描述
我有许多 VC 6.0 项目 (dsps),它们构建到没有资源文件的 dll 中.知道如何将资源添加到现有项目中吗?
I have a number of VC 6.0 projects (dsps) which build into dlls which don't have resource files. Any idea how to add resources into an existing project?
该项目即将发布主要版本,我想为目前缺少的那些 dll 添加一个文件版本.这些 dll 将在发布之前重新编译,所以我只是想使这些 dsps 像我从这个项目中继承的所有其他 dsps 一样(确实有文件和产品版本等,以便我们可以轻松地准确地知道在客户的机器.
The project is due for a major release shortly and I want to add a fileversion to those dlls currently lacking one. The dlls will be recompilied before release so I'm just trying to make these dsps like all the others I've inherited with this project (that do have a file and product version etc so that we can easily tell exactly what is running on a customer's machine.
一个答案:创建一个*.rc 和resource.h 文件(从另一个项目复制?)并将其添加到VC6 文件视图中ypur 项目的源文件夹中.资源视图是自动创建的.感谢你们的帮助,给了我需要的指点.
One answer : Create an *.rc and resource.h file (copy from another project?) and add it to the source folder of ypur project in VC6 file view. The resource view is automatically created. Thanks for your help guys, gave me the pointers I needed.
推荐答案
只需将 VERSIONINFO 块添加到 DLL 的资源文件中即可.
Just add a VERSIONINFO block to the resource file for the DLL.
打开 .rc 文件,然后使用Insert/Resource.../Version",您将获得一个带有一堆默认值的新 VERSIONINFO 资源.如果项目还没有资源文件,您可以使用文件/新建.../资源脚本"添加一个.
Open the .rc file, and use "Insert/Resource.../Version" and you'll get a new VERSIONINFO resource with a bunch of defaults. If the project does not already have a resource file, you can add one using "File/New.../Resource Script".
如果您想推出自己的产品,:
If you want to roll your own, an example VERSIONINFO
block is given on the MSDN page for VERSIONINFO:
#define VER_FILEVERSION 3,10,349,0
#define VER_FILEVERSION_STR "3.10.349.0\0"
#define VER_PRODUCTVERSION 3,10,0,0
#define VER_PRODUCTVERSION_STR "3.10\0"
#ifndef DEBUG
#define VER_DEBUG 0
#else
#define VER_DEBUG VS_FF_DEBUG
#endif
VS_VERSION_INFO VERSIONINFO
FILEVERSION VER_FILEVERSION
PRODUCTVERSION VER_PRODUCTVERSION
FILEFLAGSMASK VS_FFI_FILEFLAGSMASK
FILEFLAGS (VER_PRIVATEBUILD|VER_PRERELEASE|VER_DEBUG)
FILEOS VOS__WINDOWS32
FILETYPE VFT_DLL
FILESUBTYPE VFT2_UNKNOWN
BEGIN
BLOCK "StringFileInfo"
BEGIN
BLOCK "040904E4"
BEGIN
VALUE "CompanyName", VER_COMPANYNAME_STR
VALUE "FileDescription", VER_FILEDESCRIPTION_STR
VALUE "FileVersion", VER_FILEVERSION_STR
VALUE "InternalName", VER_INTERNALNAME_STR
VALUE "LegalCopyright", VER_LEGALCOPYRIGHT_STR
VALUE "LegalTrademarks1", VER_LEGALTRADEMARKS1_STR
VALUE "LegalTrademarks2", VER_LEGALTRADEMARKS2_STR
VALUE "OriginalFilename", VER_ORIGINALFILENAME_STR
VALUE "ProductName", VER_PRODUCTNAME_STR
VALUE "ProductVersion", VER_PRODUCTVERSION_STR
END
END
BLOCK "VarFileInfo"
BEGIN
/* The following line should only be modified for localized versions. */
/* It consists of any number of WORD,WORD pairs, with each pair */
/* describing a language,codepage combination supported by the file. */
/* */
/* For example, a file might have values "0x409,1252" indicating that it */
/* supports English language (0x409) in the Windows ANSI codepage (1252). */
VALUE "Translation", 0x409, 1252
END
END
这篇关于将资源文件添加到 VC6 dll的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!