-
Notifications
You must be signed in to change notification settings - Fork 0
/
splash.cpp
44 lines (40 loc) · 1.44 KB
/
splash.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
//---------------------------------------------------------------------------
#include <vcl.h>
#pragma hdrstop
#include "splash.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
TSplashForm *SplashForm;
//---------------------------------------------------------------------------
__fastcall TSplashForm::TSplashForm(TComponent* Owner)
: TForm(Owner){
DWORD h;
DWORD Size=GetFileVersionInfoSize(Application->ExeName.c_str(), &h);
if(Size==0) return;
char *buf;
buf=(char*)GlobalAlloc(GMEM_FIXED, Size);
if(GetFileVersionInfo(Application->ExeName.c_str(), h, Size, buf)!=0)
{
char *ValueBuf;
UINT Len;
VerQueryValue(buf, "\\VarFileInfo\\Translation", &(void*)ValueBuf, &Len);
if(Len>=4)
{
AnsiString CharSet=IntToHex((int)MAKELONG(*(int*)(ValueBuf+2), *(int*)ValueBuf), 8);
if(VerQueryValue(buf,
AnsiString("\\StringFileInfo\\"+CharSet+"\\FileVersion").c_str(),
&(void*)ValueBuf,
&Len)!=0){
Label3->Caption = ValueBuf;
}
}
}
GlobalFree(buf);
}
//---------------------------------------------------------------------------
void __fastcall TSplashForm::Timer1Timer(TObject *Sender){
Close();
Free();
}
//---------------------------------------------------------------------------