ne znau kak v .NET(tam navernoe cherz VBScript) no VC6 bot tak:
1.
sozdal versionno.dsm (.NET naverno VBScript)
ustanovil eto macro
'------------------------------------------------------------------------------
'FILE DESCRIPTION: incerments build number
'------------------------------------------------------------------------------
Function GetProjectDir(FullName)
'VC++ doesn't provide any method for getting the path of the active project
'See the VB Script reference for more information on the VB Script functions
'used in this function
Dim proj_path
proj_path = Split(StrReverse(FullName),"\",-1,1)
Dim count
count = UBound(proj_path)
Dim full_path
full_path = ""
Dim i
for i = 1 to count
full_path = full_path & "\" & proj_path(i)
next
GetProjectDir = StrReverse(full_path)
End Function
Sub ReplaceText(selection, count, incrementby)
'selection represents the TextSelection object
'count represents the position of the version number to be incremented
'incrementby represents a number that will be added to the existing version number
selection.WordRight dsMove, count
selection.WordRight dsExtend, 1
Dim str
str = selection.Text
str = str + incrementby
selection.Text = str
End Sub
Sub Application_BuildFinish(numError, numWarning)
'This event will be triggered after every build of a project
'You can check numError and/or numWarning to determine if you want to continue
If numError <> 0 Then
exit sub
end if
'Obtain the full path of the active project
Dim full_path
full_path = GetProjectDir(ActiveProject.FullName)
full_path = full_path & "..\versionno.h"
'Open the VersionNo.h file
Documents.Open full_path
'Obtain the TextSelection object
Dim selection
set selection = ActiveDocument.Selection
selection.StartOfDocument
'Increment the version information
ReplaceText selection, 9, 1
selection.LineDown
selection.StartOfLine
ReplaceText selection, 9, 1
selection.LineDown
selection.StartOfLine
ReplaceText selection, 10, 1
selection.LineDown
selection.StartOfLine
ReplaceText selection, 10, 1
ActiveDocument.Save
ActiveDocument.Close
End Sub ---
2. sozdal versionno.h :
#define FILEVER 2,0,0,0
#define PRODUCTVER 2,0,0,0
#define STRFILEVER "2, 0, 0, 0\0"
#define STRPRODUCTVER "2, 0, 0, 0\0"
---
3. podpravil resource file *.rc :
/////////////////////////////////////////////////////////////////////////////
//
// Version
//
//dobavil etot include->
#include "..\VersionNo.h"
VS_VERSION_INFO VERSIONINFO
FILEVERSION FILEVER
PRODUCTVERSION PRODUCTVER
FILEFLAGSMASK 0x3fL
#ifdef _DEBUG
FILEFLAGS 0x1L
#else
FILEFLAGS 0x0L
#endif
FILEOS 0x4L
FILETYPE 0x1L
FILESUBTYPE 0x0L
BEGIN
BLOCK "StringFileInfo"
BEGIN
BLOCK "040904b0"
BEGIN
VALUE "Comments", "\0"
VALUE "CompanyName", "My Company Inc.\0"
VALUE "FileDescription", "some Module\0"
VALUE "FileVersion", STRFILEVER
VALUE "InternalName", "STP\0"
VALUE "LegalCopyright", "Copyright (c) 2002, My company Inc.\0"
VALUE "LegalTrademarks", "\0"
VALUE "OLESelfRegister", "\0"
VALUE "OriginalFilename", "my.EXE\0"
VALUE "PrivateBuild", "\0"
VALUE "ProductName", "my Module\0"
VALUE "ProductVersion", STRPRODUCTVER
VALUE "SpecialBuild", "\0"
VALUE "Author", "me\0"
END
END
BLOCK "VarFileInfo"
BEGIN
VALUE "Translation", 0x409, 1200
END
END
---
4. Posle kazdoko uspeshnogo BUILD build number budet uvelichen na 1.
versionno.h u menia v ..\ directory t.k. On u menia odin dlia vseh modules v proekte
P.S.
mozhesh s macro poigrat`sia esli hochesh bolee mudreno sdelat`
|