如何取得ActiveForm的版本号(50分)

  • 主题发起人 主题发起人 mickeyboy
  • 开始时间 开始时间
M

mickeyboy

Unregistered / Unconfirmed
GUEST, unregistred user!
使用GetFileVersionInfo取出的是IE的版本号,那么ActiveForm的版本号要怎么获取呢
 
我的系統正好有,
抽出的代碼如下,不知是否有遺漏

type
TVersionLanguage = (vlArabic, vlBulgarian, vlCatalan, vlTraditionalChinese,
vlCzech, vlDanish, vlGerman, vlGreek, vlUSEnglish, vlCastilianSpanish,
vlFinnish, vlFrench, vlHebrew, vlHungarian, vlIcelandic, vlItalian,
vlJapanese, vlKorean, vlDutch, vlNorwegianBokmel, vlPolish,
vlBrazilianPortuguese, vlRhaetoRomanic, vlRomanian, vlRussian,
vlCroatoSerbian, vlSlovak, vlAlbanian, vlSwedish, vlThai, vlTurkish,
vlUrdu, vlBahasa, vlSimplifiedChinese, vlSwissGerman, vlUKEnglish,
vlMexicanSpanish, vlBelgianFrench, vlSwissItalian, vlBelgianDutch,
vlNorwegianNynorsk, vlPortuguese, vlSerboCroatian, vlCanadianFrench,
vlSwissFrench, vlUnknown);

const LanguageValues: array[TVersionLanguage] of Word = ($0401, $0402, $0403,
$0404, $0405, $0406, $0407, $0408, $0409, $040A, $040B, $040C, $040D,
$040E, $040F, $0410, $0411, $0412, $0413, $0414, $0415, $0416, $0417,
$0418, $0419, $041A, $041B, $041C, $041D, $041E, $041F, $0420, $0421,
$0804, $0807, $0809, $080A, $080C, $0810, $0813, $0814, $0816, $081A,
$0C0C, $100C, $0000);

function TVU_PublicFunction.GetCurrentVersionNo: String;
var
dLength,dSize:DWORD;
pcBuf,pcValue:PChar;
TempVersionLanguage:TVersionLanguage;
sTemp:String;
acFileName:Array [0..255] of Char;
begin
Result:='';

GetModuleFileName(HInstance,acFileName,SizeOf(acFileName)-1);

dSize:=GetFileVersionInfoSize(acFileName,dSize);

if dSize=0 then Exit;

pcBuf:=AllocMem(dSize);

GetFileVersionInfo(acFileName,0,dSize,pcBuf);

if VerQueryValue(pcBuf, PChar('/VarFileInfo/Translation'),Pointer(pcValue),dLength) then
begin
for TempVersionLanguage := vlArabic to vlUnknown do
if LoWord(Longint(Pointer(pcValue)^)) = LanguageValues[TempVersionLanguage] then Break;

sTemp:=IntToHex(MakeLong(HiWord(Longint(Pointer(pcValue)^)), LoWord(Longint(Pointer(pcValue)^))), 8);

if VerQueryValue(pcBuf,PChar('StringFileInfo/'+sTemp+'/FileVersion'),Pointer(pcValue),dLength) then
Result:=StrPas(pcValue);
end;

FreeMem(pcBuf,dSize);
end;
 
测试可行,谢谢
 
后退
顶部