社区
Delphi
帖子详情
???如何取得其它*.EXE和*.DLL文件的版本号???
erp2
2002-05-06 12:14:09
如题。
最好有例子。
...全文
96
1
打赏
收藏
???如何取得其它*.EXE和*.DLL文件的版本号???
如题。 最好有例子。
复制链接
扫一扫
分享
转发到动态
举报
AI
作业
写回复
配置赞助广告
用AI写文章
1 条
回复
切换为时间正序
请发表友善的回复…
发表回复
打赏红包
Bob7946
2002-05-06
打赏
举报
回复
获取文件版本信息
type
TFileInfo = packed record
CommpanyName: string;
FileDescription: string;
FileVersion: string;
InternalName: string;
LegalCopyright: string;
LegalTrademarks: string;
OriginalFileName: string;
ProductName: string;
ProductVersion: string;
Comments: string;
VsFixedFileInfo:VS_FIXEDFILEINFO;
UserDefineValue:string;
end;
function GetFileVersionInfomation(const FileName: string; var info: TFileInfo;UserDefine:string=''):
boolean;
const
SFInfo= '\StringFileInfo\';
var
VersionInfo: Pointer;
InfoSize: DWORD;
InfoPointer: Pointer;
Translation: Pointer;
VersionValue: string;
unused: DWORD;
begin
unused := 0;
Result := False;
InfoSize := GetFileVersionInfoSize(pchar(FileName), unused);
if InfoSize > 0 then
begin
GetMem(VersionInfo, InfoSize);
Result := GetFileVersionInfo(pchar(FileName), 0, InfoSize, VersionInfo);
if Result then
begin
VerQueryValue(VersionInfo, '\VarFileInfo\Translation', Translation, InfoSize);
VersionValue := SFInfo + IntToHex(LoWord(Longint(Translation^)), 4) +
IntToHex(HiWord(Longint(Translation^)), 4) + '\';
VerQueryValue(VersionInfo, pchar(VersionValue + 'CompanyName'), InfoPointer, InfoSize);
info.CommpanyName := string(pchar(InfoPointer));
VerQueryValue(VersionInfo, pchar(VersionValue + 'FileDescription'), InfoPointer, InfoSize);
info.FileDescription := string(pchar(InfoPointer));
VerQueryValue(VersionInfo, pchar(VersionValue + 'FileVersion'), InfoPointer, InfoSize);
info.FileVersion := string(pchar(InfoPointer));
VerQueryValue(VersionInfo, pchar(VersionValue + 'InternalName'), InfoPointer, InfoSize);
info.InternalName := string(pchar(InfoPointer));
VerQueryValue(VersionInfo, pchar(VersionValue + 'LegalCopyright'), InfoPointer, InfoSize);
info.LegalCopyright := string(pchar(InfoPointer));
VerQueryValue(VersionInfo, pchar(VersionValue + 'LegalTrademarks'), InfoPointer, InfoSize);
info.LegalTrademarks := string(pchar(InfoPointer));
VerQueryValue(VersionInfo, pchar(VersionValue + 'OriginalFileName'), InfoPointer, InfoSize);
info.OriginalFileName := string(pchar(InfoPointer));
VerQueryValue(VersionInfo, pchar(VersionValue + 'ProductName'), InfoPointer, InfoSize);
info.ProductName := string(pchar(InfoPointer));
VerQueryValue(VersionInfo, pchar(VersionValue + 'ProductVersion'), InfoPointer, InfoSize);
info.ProductVersion := string(pchar(InfoPointer));
VerQueryValue(VersionInfo, pchar(VersionValue + 'Comments'), InfoPointer, InfoSize);
info.Comments := string(pchar(InfoPointer));
if VerQueryValue(VersionInfo, '\', InfoPointer, InfoSize) then
info.VsFixedFileInfo := TVSFixedFileInfo(InfoPointer^);
if UserDefine<>'' then
begin
if VerQueryValue(VersionInfo,pchar(VersionValue+UserDefine),InfoPointer,InfoSize) then
info.UserDefineValue:=string(pchar(InfoPointer));
end;
end;
FreeMem(VersionInfo);
end;
end;
调用演示:
procedure TForm1.Button1Click(Sender: TObject);
var
info: TFileInfo;
begin
if OpenDialog1.Execute then
begin
if GetFileVersionInfomation(opendialog1.FileName, info,'WOW Version') then
begin
Listbox1.Items.Add(OpenDialog1.FileName);
ListBox1.Items.Add('Comments:' + info.Comments);
ListBox1.Items.Add('CommpanyName:' + info.CommpanyName);
ListBox1.Items.Add('FileDescription:' + info.FileDescription);
ListBox1.Items.Add('FileVersion:' + info.FileVersion);
ListBox1.Items.Add('InternalName:' + info.InternalName);
ListBox1.Items.Add('LegalCopyright:' + info.LegalCopyright);
ListBox1.Items.Add('LegalTrademarks:' + info.LegalTrademarks);
ListBox1.Items.Add('OriginalFileName:' + info.OriginalFileName);
ListBox1.Items.Add('ProductName:' + info.ProductName);
ListBox1.Items.Add('ProductVersion:' + info.ProductVersion);
ListBox1.Items.Add('UserDefineValue:' + info.UserDefineValue);
if boolean(info.VsFixedFileInfo.dwFileFlags and vs_FF_Debug) then
listbox1.Items.Add('Debug:True')
else
ListBox1.Items.Add('Debug:False');
ListBox1.Items.Add('');
end;
end;
end;
收集的各种版本的libeay32.
dll
+ssleay32.
dll
总有一款适合你
这允许开发者根据他们的Delphi项目和Indy库的具体需求,选择最适合的库
文件
版本。例如,WMWareV7.0For64Win7_VMMount和WMWare7.15-491717-1可能需要特定版本的OpenSSL库来支持其虚拟机环境中的SSL通信。 PHP5.3的...
从资源
DLL
中选取图标的对话框
5. **resource.h**:这个
文件
通常存放应用程序的资源定义,包括图标资源的ID号和其他静态资源,如菜单项、控件等。 6. **StdAfx.cpp** 和 **StdAfx.h**:这些
文件
是MFC项目的标准模块,包含了预编译头
文件
...
实用经验 96 可执行
文件
*.
exe
(*.
dll
)剖析
这些二进制微处理器指令的编码,于各种微处理器有所不同,故此可执行
文件
多数要分开不同的微处理版本。每个C++可执行程序都包含
文件
头,代码段,数据段。他们是怎么存储的这是你需要掌握的。了解可执行
文件
布局,...
.lib和.
dll
.
exe
文件
的区别和联系,以及导出
dll
的两种方法
注:本文内容均收集于网络后总结。 1 .lib和.
dll
.
exe
的区别 ...动态链接库
文件
的扩展名一般是
dll
,也有可能是drv、sys和fon,它和可执行
文件
(
exe
)非常类似..
dll
是在你的程序运行的时候才连接的
文件
,因此它是一种比较
C/C++::浅谈.obj .
exe
.
dll
.lib关系&& .o .a .so关系
浅谈.lib .
dll
.obj 关系&& .a .so .o关系 一、.obj .
exe
.
dll
.lib (1).obj 目标
文件
,相当于源代码对应的二进制
文件
。 obj
文件
就是用.c .cpp .h
文件
经过编译器编译之后生成的目标
文件
。 ...
Delphi
5,928
社区成员
262,931
社区内容
发帖
与我相关
我的任务
Delphi
Delphi 开发及应用
复制链接
扫一扫
分享
社区描述
Delphi 开发及应用
社区管理员
加入社区
获取链接或二维码
近7日
近30日
至今
加载中
查看更多榜单
社区公告
暂无公告
试试用AI创作助手写篇文章吧
+ 用AI写文章