????? ????? ??????? ??????? ??? ?? ????? ?? Visual C++

?????? ????????? ?????? ?????????
???? ???????: 237870 - ??? ???????? ???? ????? ????? ??? ???????.
????? ???? | ?? ????

??????

?? ??? Visual C++ ???? ?????? ??????? ??????? ????? ??????? ??? ?? ????? ????????. ???? ??? ??????? ????? ?????? ??? ??? ????.

??????? ????

????? ????? ?????? ?????? ??? ?????? ??????? ??????? (.rc) ?????? ????? ?? ??????? ??????? ??????? ???. ??? ???? ???? ????? RC ??? ???? Visual C++. C++ ??????? ?????? ??? RC ????? ????? ?? ?? ???? ??? ??? ???? ???????. ???? ????? ??????? ???????? ?? ??? ?????? ??? ?? ????? Visual C++. ?????? ??? ?????? ????? ???? Foundation Microsoft.

????? ????? ???? ???????? Appwizard MFC (EXE) ? ?????? MyProject. ????? MyProject ??? MyProject.rc ????? MyProject.rc2. ??? ???? ????? .rc2 ??????? ??????? ?? ??? ????????. ???? ??? ??????? ????? ??????? ??????? ?????? MyProject ??? ?? ???????:
  1. ????? ???? ??????? ?? ??? .rc ?????? ?? ??? .rc2:

    1. ???? ?? MyProject.rc MyProject.rc2 (????? ?? ???? Res) ?? ???? ??. ??????? ???? Visual C++ ? ???? ??? ??? ?? ??????? "???" ?? ??? ???? ?? ??????? ??? ???? ????? MyProject.rc.
    2. ?????? ??? ??????? ?????? ?????? ?? MyProject.rc. ??? ?? ???? ??? ?? ???:
      /////////////////////////////////////////////////////////////////////// 
      // 
      // Version
      // 
      
      VS_VERSION_INFO VERSIONINFO
       FILEVERSION 1,0,0,1
       PRODUCTVERSION 1,0,0,1
       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", "Sample Application\0"
                  VALUE "CompanyName", "Microsoft Corp.\0"
                  VALUE "FileDescription", "MyProject MFC Application\0"
                  VALUE "FileVersion", "1, 0, 0, 1\0"
                  VALUE "InternalName", "MyProject\0"
                  VALUE "LegalCopyright", "Copyright (C) 1999\0"
                  VALUE "OriginalFilename", "MyProject.EXE\0"
                  VALUE "ProductName", "MyProject Application\0"
                  VALUE "ProductVersion", "1, 0, 0, 1\0"
              END
          END
          BLOCK "VarFileInfo"
          BEGIN
              VALUE "Translation", 0x409, 1200
          END
      END
      							
    3. ?? ???? ??????? ?? ??? MyProject.rc ????? ?? ????? MyProject.rc2 ????? ??????? "????? ?????? ????? ??????? ???." ?????? ??? ??????? ??? ???? ?? ???? ?? ?????? ?? ?????? ???? ???? ?????? VERSIONINFO ?? ?????????.
  2. ??????? ???????? FILEVERSION PRODUCTVERSION ????? ??????? FILEVER ? PRODUCTVER. ????? ?????? ??????? ?????? ????? FileVersion ? ProductVersion ????? ??????? STRFILEVER ? STRPRODUCTVER.
  3. ????? # ????? VersionNo.h ?????? ??? ????? ?????? VS_VERSION_INFO. ???? ????? ???? ??????? ???:
    /////////////////////////////////////////////////////////////////////// 
    // 
    // Version
    // 
    #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", "Sample Application\0"
                VALUE "CompanyName", "Microsoft Corp.\0"
                VALUE "FileDescription", "MyProject MFC Application\0"
                VALUE "FileVersion", STRFILEVER
                VALUE "InternalName", "MyProject\0"
                VALUE "LegalCopyright", "Copyright (C) 1997\0"
                VALUE "OriginalFilename", "MyProject.EXE\0"
                VALUE "ProductName", "MyProject Application\0"
                VALUE "ProductVersion", STRPRODUCTVER
            END
        END
        BLOCK "VarFileInfo"
        BEGIN
            VALUE "Translation", 0x409, 1200
        END
    END
    					
  4. ????? ??? ??? ???? VersionNo.h ?? ??? ??????? ??????. ????? ??? ????? ??? ???????? ??????? ????? ?? ??????? ????? ??????? ????????? ?? ?????? 2:
    #define FILEVER        1,0,0,1
    #define PRODUCTVER     1,0,0,1
    #define STRFILEVER     "1, 0, 0, 1\0"
    #define STRPRODUCTVER  "1, 0, 0, 1\0"
    						
    ??????: ????? ????? ? ??? ????? ?????? ?? ????? ??????.

    ????? ????? ??? MyProject.rc MyProject.rc2 ?????? ??? MyProject.rc2 VersionNo.h.
  5. ???? ????? ??????? ????? VersionNo.h ???????? ????? Visual Basic Script. ??????? ??? ????? ????? ????? BuildFinish Visual C++ ? ??? ???? ??? ?? ??? ????? ??? ??? ?????. ????? ??? ??????? ??? ???????? ???????? ?????? VB ???? ?????? ????? ????????? ???? ??? ????? ????? ?????? ????? ???? ?? ???? ???? ????? ?????? ????. ????? ????? ?????, ??? ????? ??? ??????? ?????? ?? ????? ?????? ???????.

    ?????? ???????? ??? ?????? VB ?? ??? ???:

    1. ??? ??? DSM (???????) ????? ?? ????? ??? DSM ???? ?? Visual C++. ?????? ??? ???? ???? ??? "????" ?? ????? "???" ? ??? ??? ????? ?? ??????? ????? ?????? ??? ????? ?? ???? ??? ?????.
    2. ?? ???? ???????? ???????? ?????? VB ??????? ????? (?? ???? ????? ??? DSM ???? ?? Visual C++; ???? ?????? ??????? ??????):
      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
      '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
      								
      ??????: ??? ??? ????? ??? ?????. ?? ??????? ???????? ???????.
    3. ????? ??? DSM ??? ?? ??? ?????? ??????. ?????? ? ???? ??? ????? ?? ??????? ????? ???? ??? ????? ??????? ??????? ???????? ???????? ????? ? ?????? ?????? ??? DSM ?? ???? ??? ?????.
  6. ??? ????? MyProject.exe ?? ??????? ????. ??? ?????? ??????? ??? ??? VersionNo.h. ??? ????? ??? ???????? ???????:
    #define FILEVER        1,0,0,2
    #define PRODUCTVER     1,0,0,2
    #define STRFILEVER     "1, 0, 0, 2\0"
    #define STRPRODUCTVER  "1, 0, 0, 2\0"
    						
    ??? ????? ????????? ???????? ??? ????? ??? ??????? ??????? ?? ??????? ?? ????? ???????? ???? ?????? ??????? ???????. ???? ????? ??? ????????? ???????? ?? ????? ???? ?? ??? ???? ????? ????????? incrementing ??? ??????? ??????? ?????.

?????

?????? ??? ???? ?? ????????? ??? ???? ???? Visual C++ ???? ??????? ?????? ?? ????? MSDN:
http://msdn.microsoft.com/en-us/library/aa712880(VS.71).aspx

?????? ??? ???? ?? ????????? ??? ????? ??????? ?????? VB ???? ??????? ?????? ?? ????? MSDN:
http://msdn.microsoft.com/en-us/library/aa247202(VS.60).aspx

?????? ??? ???? ?? ????????? ??? ?????? VB ????? ???? ??????? ?????? ?? ????? MSDN:
http://msdn.microsoft.com/en-us/library/d1wf56tt(vs.71).aspx

?????? ??? ???? ?? ????????? ??? ???? ?????? VERSIONINFO Visual C++ ? ???? ??????? ?????? ?? ????? MSDN:
http://msdn.microsoft.com/en-us/library/aa381043.aspx

???????

???? ???????: 237870 - ????? ??? ??????: 28/???/1426 - ??????: 3.2
????? ???
  • Microsoft Visual C++ 5.0 Enterprise Edition
  • Microsoft Visual C++ 6.0 Enterprise Edition
  • Microsoft Visual C++ 5.0 Professional Edition
  • Microsoft Visual C++ 6.0 Professional Edition
  • Microsoft Visual C++, 32-bit Learning Edition 6.0
????? ??????: 
kbmt kbautomation kbdevstudio kbhowto kbide kbscript kbvcobj KB237870 KbMtar
????? ????
???: ??? ????? ??? ?????? ???????? ?????? ????? ???? ????? ?????????? ????? ?? ????????? ?????? ????. ???? ???? ?????????? ???? ?? ???????? ???????? ?????? ????????? ????? ????????? ???????? ????? ???????? ?????? ?? ?????? ??? ?? ???????? ???????? ?? ????? ??????? ?????? ??? ??????? ?????? ??. ?????? ?? ???? ??? ??????? ???????? ????? ?? ???? ????? ?????? ??? ????? ??? ????? ??????? ?? ????? ?? ?????? ??? ??? ??????? ??????? ?? ????? ????? ????? ????? ?????. ?? ????? ???? ?????????? ??????? ??? ????? ?? ??????? ?? ????? ?????? ?? ??? ????? ?? ????? ??????? ?? ???????? ?? ??? ???????. ???? ???? ?????????? ???????? ??? ????? ?????? ??????? ??????
???? ??? ????? ??????? ?????? ??????????237870

????? ???????

 

Contact us for more help

Contact us for more help
Connect with Answer Desk for expert help.
Get more support from smallbusiness.support.microsoft.com