1 void __fastcall TForm1::FormCreate(TObject *Sender)
2 {
3 DWORD dwVerInfoSize = 0;
4 AnsiString szFile = Application->ExeName;
5 dwVerInfoSize = GetFileVersionInfoSize(szFile.c_str(), &dwVerInfoSize);
6 BYTE *bVerInfoBuf = new BYTE[dwVerInfoSize];
7 if (GetFileVersionInfo(szFile.c_str(), 0, dwVerInfoSize, bVerInfoBuf))
8 {
9 VS_FIXEDFILEINFO *vsInfo;
10 UINT vsInfoSize;
11 if (VerQueryValue(bVerInfoBuf, "\\", (void**)&vsInfo, &vsInfoSize))
12 {
13 int iFileVerMajor = HIWORD(vsInfo->dwFileVersionMS);
14 int iFileVerMinor = LOWORD(vsInfo->dwFileVersionMS);
15 int iFileVerRelease = HIWORD(vsInfo->dwFileVersionLS);
16 int iFileVerBuild = LOWORD(vsInfo->dwFileVersionLS);
17 Caption = IntToStr(iFileVerMajor) + "." + IntToStr(iFileVerMinor) +
18 "." + IntToStr(iFileVerRelease) + "." + IntToStr(iFileVerBuild);
19 }
20 }
21 delete bVerInfoBuf;
22 }



更多詳情請看 http://delphi.ktop.com.tw/topic.asp?TOPIC_ID=34575

全站熱搜

Nelson 發表在 痞客邦 留言(0) 人氣()