马大哈 发表于 2009-10-12 03:16:11

【分享】马大哈系列功能模块----取文件信息(版本号,公司名称等)

VB里面取自己的版本信息比较简单,使用APP对象即可.
但要取得别的文件的相关信息,需要调用GetFileVersionInfo来完成,有一堆代码,比较麻烦.
这里这个模块将代码封装了一下,使得调用大大简化,如下:

Public Function GetFileVerInfo(FullFileName As String) As String()
    '返回的数组中各元素的说明:
    '0 = FileVersion, 1 = InternalName, 2 = CompanyName, 3 = LegalCopyright, 4 = FileDescription.



msgbox GetFileVerInfo("C:\windows\notepad.exe")(0)      '版本号
msgbox GetFileVerInfo("C:\windows\notepad.exe")(1)      '产品名称
msgbox GetFileVerInfo("C:\windows\notepad.exe")(2)      '公司名称
msgbox GetFileVerInfo("C:\windows\notepad.exe")(3)      '版权信息
msgbox GetFileVerInfo("C:\windows\notepad.exe")(4)      '文件描述



**************************************************
修改了一下,增加了一个功能,可以在没有Translation节的情况下,尝试自己解析,得到代码页信息.

everyone 发表于 2009-10-19 23:24:28

谢谢!

everyone 发表于 2009-10-21 18:55:25

好东西啊,正在找呢,刚好就在马哥这里看到了,谢谢分享

马大哈 发表于 2009-11-23 21:07:49

**************************************************
修改了一下,增加了一个功能,可以在没有Translation节的情况下,尝试自己解析,得到代码页信息.

reaten 发表于 2010-4-24 21:32:25

请问这个模块怎么调用?

马大哈 发表于 2010-4-24 21:47:11

只有唯一一个函数,上面有例子.

返回值是数组.

upring 发表于 2015-10-26 08:52:11

马总在打造vb版易语言模块
页: [1]
查看完整版本: 【分享】马大哈系列功能模块----取文件信息(版本号,公司名称等)