GetExeFileVersion(pchar('//10.192.2.1/file/myfile.exe');
前提是10.192.2.1有File这个共享目录,而且你有读取的权限。
function GetExeFileVersion(FileName:String):String;
var InfoSize,Wnd
WORD;
VerBuf
ointer;
VerInfo:^VS_FIXEDFILEINFO;
begin
Result:='';
InfoSize:=GetFileVersionInfoSize(PChar(FileName),Wnd);
if InfoSize<>0 then
begin
GetMem(VerBuf,InfoSize);
try
if GetFileVersionInfo(PChar(FileName),Wnd,InfoSize,VerBuf) then
begin
VerInfo:=nil;
VerQueryValue(VerBuf,'/',Pointer(VerInfo),Wnd);
if VerInfo<>nil then Result:=Format('%d.%d.%d.%d',[VerInfo^.dwFileVersionMS shr 16,
VerInfo^.dwFileVersionMS and $0000ffff,
VerInfo^.dwFileVersionLS shr 16,
VerInfo^.dwFileVersionLS and $0000ffff]);
end;
finally
FreeMem(VerBuf,InfoSize);
end;
end;
end;