三个js文件叫increment.js,version.h,build.h
修改资源文件,参考上一篇文章。把3个文件拷贝到工程目录下面。在net2003的项目属性-〉生成事件-〉预生成事件-〉添加 $(ProjectDir)increment.js
==========================================代码如下
main();
function main()
{
var bDebug = false
var Args = WScript.Arguments;
if(Args.length > 0 && Args(0) == "/debug")
bDebug = true;
// Create shell object
var WSShell = WScript.CreateObject("WScript.Shell");
// Create file system object
var FileSys = WScript.CreateObject("Scripting.FileSystemObject");
var strValue = FileSys.GetAbsolutePathName("");
if(strValue == null || strValue == "")
strValue = ".";
var strSourceFolder = FileSys.BuildPath(strValue, "build.h");
if(bDebug)
WScript.Echo("Source: " + strSourceFolder);
var strTextStream = FileSys.OpenTextFile(strSourceFolder, 1, false);
var x;
strTextStream.SkipLine();
var str = strTextStream.ReadLine()
x = parseInt(str) + 1;
if(bDebug)
WScript.Echo(x);
strTextStream.Close();
strTextStream = FileSys.OpenTextFile(strSourceFolder, 2, false);
strTextStream.WriteLine("#define build ///r/n" + x);
strTextStream.Close();
}
================================================
version.h
#pragma once
#include "build.h"
#define BUILD build
#define STR_(i) #i
#define STR(i) STR_(i)
#define FILEVER 1,1,0,0
#define PRODUCTVER 1,1,1, BUILD
#define STRFILEVER "1, 1, 0, 0/0"
#define STRPRODUCTVER "1, 1, 0, " STR(BUILD) "/0"
===============================================
build.h
#define build /
1
===============================================