Delphi 取得文件版本


本文整理自网络,侵删。

 
//取得文件版本
function GetFileVer(strFileName: String): String;
var
    n, Len: DWORD;
    Buf : PChar;
    Value: Pointer;
    szName: array [0..255] of Char;
    Transstring: String;
begin
    Len := GetFileVersionInfoSize(PChar(strFileName), n);
    if Len > 0 then
    begin
        Buf := AllocMem(Len);
        if GetFileVersionInfo(Pchar(strFileName), n, Len, Buf) then
        begin
            Value := nil;
            VerQueryValue(Buf, '\VarFileInfo\Translation', Value, Len);
            if Value <> nil then
            begin
                Transstring := IntToHex(MakeLong(HiWord(LongInt(Value^)), LoWord(LongInt(Value^))),8);
            end;
            StrPCopy(szName, '\stringFileInfo\' + Transstring + '\FileVersion');
            if VerQueryValue(Buf, szName, Value, Len) then
            begin
                Result := StrPas(Pchar(Value));
            end;
            FreeMem(Buf, n);
        end;
    end;
end;

相关阅读 >>

Delphi源码一个对字符加密解密的实例

Delphi判断字符串中是否包含汉字,并返回汉字位置

Delphi 缓冲文件流-tbufferedfilestream tfilestream 性能测试

Delphi 回车 选择下一个控件

Delphi webbrowser1遍历网页中的图片

Delphi 创建大窗口

Delphi 以bytes为单位获取文件大小

Delphi 中的split 函数

Delphi fmx 从app程序直接跳转到支付宝付款转帐页面

Delphi实现分割文本文件的小程序

更多相关阅读请进入《Delphi》频道 >>



打赏

取消

感谢您的支持,我会继续努力的!

扫码支持
扫码打赏,您说多少就多少

打开支付宝扫一扫,即可进行扫码打赏哦

分享从这里开始,精彩与您同在

评论

管理员已关闭评论功能...