Subversion Repositories DevTools

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
2265 kivins 1
//---------------------------------------------------------------------------
2
 
3
#include <vcl.h>
4
#pragma hdrstop
5
 
6
#include "About.h"
7
//#include "Splash.h"
8
//---------------------------------------------------------------------------
9
#pragma package(smart_init)
10
#pragma resource "*.dfm"
11
TAboutForm *AboutForm;
12
//---------------------------------------------------------------------------
13
__fastcall TAboutForm::TAboutForm(TComponent* Owner)
14
    : TForm(Owner)
15
{
16
}
17
//---------------------------------------------------------------------------
18
void __fastcall TAboutForm::FormShow(TObject *Sender)
19
{
20
    char *ExeName = Application->ExeName.c_str();
21
    AnsiString versionString, buildString;
22
     DWORD infohandle = 0;
23
     DWORD infosize = ::GetFileVersionInfoSize(ExeName, &infohandle);
24
     if (infosize > 0)
25
     {
26
         char *infobuffer = (char *) malloc(infosize+1);
27
 
28
         GetFileVersionInfo(ExeName, 0, infosize, infobuffer);
29
         void            *pValue = NULL;
30
         unsigned int    pLen = 0;
31
 
32
         if ( ::VerQueryValue(infobuffer, "\\", &pValue, &pLen) )
33
         {
34
             VS_FIXEDFILEINFO *s = (VS_FIXEDFILEINFO *)pValue;
35
 
36
             int major = HIWORD(s->dwFileVersionMS);
37
             int minor = LOWORD(s->dwFileVersionMS);
38
             int patch = HIWORD(s->dwFileVersionLS);
39
             int build = LOWORD(s->dwFileVersionLS);
40
 
41
             buildString = "";
42
             if (build>0 ) buildString.sprintf("  Build %d",build); //pre-release
43
 
44
             versionString.sprintf("Version %d.%d.%d", major, minor, patch);                          
45
         }
46
         else versionString.sprintf("Version unknown");
47
 
48
         free(infobuffer);
49
     }
50
     else versionString = Application->ExeName.c_str(); // fallback
51
 
52
    VersionLabel->Caption = versionString + buildString;
53
}
54
//---------------------------------------------------------------------------
55