1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28: 29: 30: 31: 32: 33: 34: 35: 36: 37: 38: 39: 40: 41: 42: 43: 44: 45: 46: 47: 48: 49: 50: 51: 52: 53: 54: 55: 56: 57: 58: 59: 60: 61: 62: 63: 64: 65: 66: 67:
| Function FileVersion(const FileName: TFileName): String; Var VerInfoSize: Cardinal; VerValueSize: Cardinal; Dummy: Cardinal; PVerInfo: Pointer; PVerValue: PVSFixedFileInfo; iLastError: DWord; Begin Result := ''; VerInfoSize := GetFileVersionInfoSize(PChar(FileName), Dummy); if VerInfoSize > 0 Then Begin GetMem(PVerInfo, VerInfoSize); Try If GetFileVersionInfo(PChar(FileName), 0, VerInfoSize, PVerInfo) Then Begin If VerQueryValue(PVerInfo, '\', Pointer(PVerValue), VerValueSize) Then With PVerValue^ Do Result := Format('%d.%d.%d Build %d', [ HiWord(dwFileVersionMS), LoWord(dwFileVersionMS), HiWord(dwFileVersionLS), LoWord(dwFileVersionLS)]); End Else Begin iLastError := GetLastError; Result := Format('GetFileVersionInfo failed: (%d) %s', [iLastError, SysErrorMessage(iLastError)]); End; Finally FreeMem(PVerInfo, VerInfoSize); End; End Else Begin iLastError := GetLastError; Result := Format('GetFileVersionInfo failed: (%d) %s', [iLastError, SysErrorMessage(iLastError)]); End; End;
Function GetDefaultBrowser : TBrowserInformation; Var Tmp : PChar; Res : PChar; Version : String;
Begin Tmp := StrAlloc(255); Res := StrAlloc(255);
Try GetTempPath(255,tmp); FileCreate(tmp+'htmpl.htm'); FindExecutable('htmpl.htm',tmp,Res); Result.Name := ExtractFileName(res); Result.Path := ExtractFilePath(res); Result.Version := FileVersion(res); SysUtils.DeleteFile(tmp+'htmpl.htm'); Finally StrDispose(tmp); StrDispose(res); End; End; |