怎么获取DLL的版本信息? 如何获取DLL的版本信息? 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 和获取exe版本信息有区别吗? 如果Dll是你自己写的话,在Dll中创建一个输出函数,来返回你的Dll版本信息function GetVersionInfo: ShortString; stdcall;const cVersionInfoStr='Ver1.0. 2010-06-22';begin Result:=cVersionInfoStr;end然后再到你的应用程序中调用它就行了,而每次你编译Dll时,手工修改GetVersion中的版本信息。 procedure GetVersionInfo(FFilePath: string);const SNotAvailable = 'Value Not Available';var LanguageID: string; CodePage: string; TranslationLength: Cardinal; TranslationTable: Pointer; InfoSize, Temp, Len: DWord; InfoBuf: Pointer; CompanyName, FileDescription, FileVersion, InternalName, LegalCopyright: string; LegalTradeMarks, OriginalFilename, ProductName, ProductVersion, Comments: string; Value: PChar; LookupString: string; PathStz: array[ 0..MAX_PATH ] of Char;begin // Get File Version Information if FFilePath = '' then begin GetModuleFileName( HInstance, PathStz, SizeOf( PathStz ) ); FFilePath := StrPas( PathStz ); end; InfoSize := GetFileVersionInfoSize( PChar( FFilePath ), Temp ); if InfoSize > 0 then begin InfoBuf := AllocMem( InfoSize ); try GetFileVersionInfo( PChar( FFilePath ), 0, InfoSize, InfoBuf ); if VerQueryValue( InfoBuf, '\VarFileInfo\Translation', TranslationTable, TranslationLength ) then begin CodePage := Format( '%.4x', [ HiWord( PLongInt( TranslationTable )^ ) ] ); LanguageID := Format( '%.4x', [ LoWord( PLongInt( TranslationTable )^ ) ] ); end; LookupString := 'StringFileInfo\' + LanguageID + CodePage + '\'; if VerQueryValue( InfoBuf, PChar( LookupString + 'CompanyName' ), Pointer( Value ), Len ) then CompanyName := Value; if VerQueryValue( InfoBuf, PChar( LookupString + 'FileDescription' ), Pointer( Value ), Len ) then FileDescription := Value; if VerQueryValue( InfoBuf, PChar( LookupString + 'FileVersion' ), Pointer( Value ), Len ) then FileVersion := Value; if VerQueryValue( InfoBuf, PChar( LookupString + 'InternalName' ), Pointer( Value ), Len ) then InternalName := Value; if VerQueryValue( InfoBuf, PChar( LookupString + 'LegalCopyright' ), Pointer( Value ), Len ) then LegalCopyright := Value; if VerQueryValue( InfoBuf, PChar( LookupString + 'LegalTrades' ), Pointer( Value ), Len ) then LegalTradeMarks := Value; if VerQueryValue( InfoBuf, PChar( LookupString + 'OriginalFilename' ), Pointer( Value ), Len ) then OriginalFilename := Value; if VerQueryValue( InfoBuf, PChar( LookupString + 'ProductName' ), Pointer( Value ), Len ) then ProductName := Value; if VerQueryValue( InfoBuf, PChar( LookupString + 'ProductVersion' ), Pointer( Value ), Len ) then ProductVersion := Value; if VerQueryValue( InfoBuf, PChar( LookupString + 'Comments' ), Pointer( Value ), Len ) then Comments := Value; finally FreeMem( InfoBuf, InfoSize ); end; end else begin CompanyName := SNotAvailable; FileDescription := SNotAvailable; FileVersion := SNotAvailable; InternalName := SNotAvailable; LegalCopyright := SNotAvailable; LegalTrades := SNotAvailable; OriginalFilename := SNotAvailable; ProductName := SNotAvailable; ProductVersion := SNotAvailable; Comments := SNotAvailable; end; ShowMessage(CompanyName+ #13#10 + FileDescription + #13#10 + InternalName + #13#10 + FileVersion + #13#10 + InternalName+#13#10 + LegalCopyright+#13#10 +LegalTrades+#13#10 +OriginalFilename+#13#10 +ProductName+#13#10 +ProductVersion+#13#10 +Comments);end; access 如何将数据各列求和后插入原表某一列? 求助query选择语句 怎样读取access中的一行数据显示在stringgrid中 Interbase安装问题 求系统 关于事务处理,请看看这段代码是否正确。100分 请各位指教。。自定义函数该如何声明如何写。请个例子(在线等) 能不能实现Internet上客户端直接连接,访问远程Sql server数据库? 关于listview 的问题,大家一起来讨论,来着有分哦!!!!! 刚申请的号每分啊。。有人免费帮我不啊? 这样的查询功能如何实现? 在ADO+DbGridEh中,如何获得插入行的行号?
const
cVersionInfoStr='Ver1.0. 2010-06-22';
begin
Result:=cVersionInfoStr;
end然后再到你的应用程序中调用它就行了,而每次你编译Dll时,手工修改GetVersion中的版本信息。
procedure GetVersionInfo(FFilePath: string);
const
SNotAvailable = 'Value Not Available';
var
LanguageID: string;
CodePage: string;
TranslationLength: Cardinal;
TranslationTable: Pointer;
InfoSize, Temp, Len: DWord;
InfoBuf: Pointer;
CompanyName, FileDescription, FileVersion, InternalName, LegalCopyright: string;
LegalTradeMarks, OriginalFilename, ProductName, ProductVersion, Comments: string;
Value: PChar;
LookupString: string;
PathStz: array[ 0..MAX_PATH ] of Char;
begin
// Get File Version Information
if FFilePath = '' then
begin
GetModuleFileName( HInstance, PathStz, SizeOf( PathStz ) );
FFilePath := StrPas( PathStz );
end;
InfoSize := GetFileVersionInfoSize( PChar( FFilePath ), Temp );
if InfoSize > 0 then
begin
InfoBuf := AllocMem( InfoSize );
try
GetFileVersionInfo( PChar( FFilePath ), 0, InfoSize, InfoBuf );
if VerQueryValue( InfoBuf, '\VarFileInfo\Translation', TranslationTable, TranslationLength ) then
begin
CodePage := Format( '%.4x', [ HiWord( PLongInt( TranslationTable )^ ) ] );
LanguageID := Format( '%.4x', [ LoWord( PLongInt( TranslationTable )^ ) ] );
end; LookupString := 'StringFileInfo\' + LanguageID + CodePage + '\'; if VerQueryValue( InfoBuf, PChar( LookupString + 'CompanyName' ), Pointer( Value ), Len ) then
CompanyName := Value;
if VerQueryValue( InfoBuf, PChar( LookupString + 'FileDescription' ), Pointer( Value ), Len ) then
FileDescription := Value;
if VerQueryValue( InfoBuf, PChar( LookupString + 'FileVersion' ), Pointer( Value ), Len ) then
FileVersion := Value;
if VerQueryValue( InfoBuf, PChar( LookupString + 'InternalName' ), Pointer( Value ), Len ) then
InternalName := Value;
if VerQueryValue( InfoBuf, PChar( LookupString + 'LegalCopyright' ), Pointer( Value ), Len ) then
LegalCopyright := Value;
if VerQueryValue( InfoBuf, PChar( LookupString + 'LegalTrades' ), Pointer( Value ), Len ) then
LegalTradeMarks := Value;
if VerQueryValue( InfoBuf, PChar( LookupString + 'OriginalFilename' ), Pointer( Value ), Len ) then
OriginalFilename := Value;
if VerQueryValue( InfoBuf, PChar( LookupString + 'ProductName' ), Pointer( Value ), Len ) then
ProductName := Value;
if VerQueryValue( InfoBuf, PChar( LookupString + 'ProductVersion' ), Pointer( Value ), Len ) then
ProductVersion := Value;
if VerQueryValue( InfoBuf, PChar( LookupString + 'Comments' ), Pointer( Value ), Len ) then
Comments := Value;
finally
FreeMem( InfoBuf, InfoSize );
end;
end
else
begin
CompanyName := SNotAvailable;
FileDescription := SNotAvailable;
FileVersion := SNotAvailable;
InternalName := SNotAvailable;
LegalCopyright := SNotAvailable;
LegalTrades := SNotAvailable;
OriginalFilename := SNotAvailable;
ProductName := SNotAvailable;
ProductVersion := SNotAvailable;
Comments := SNotAvailable;
end;
ShowMessage(CompanyName+ #13#10 + FileDescription + #13#10 + InternalName + #13#10 + FileVersion + #13#10 +
InternalName+#13#10 + LegalCopyright+#13#10 +LegalTrades+#13#10 +OriginalFilename+#13#10 +ProductName+#13#10
+ProductVersion+#13#10 +Comments);
end;