Code-Beispiel
Windows Versionsinfo
Lizenz: | Erster Autor: | Letzte Bearbeitung: |
k. A. | Volta | 01.01.2017 |
#Include "windows.bi"
Const CrLf = Chr(13, 10)
Const Tb = Chr(9)
Dim Anzeige As String*4000
Dim As String filename = "GDIPLUS.DLL" 'Testdatei mit VersionsInfo
Dim As Long dwSize = GetFileVersionInfoSize( filename, NULL )
If dwSize = 0 Then
MessageBox (0, "Fehler, kein Versionsinfo!", "Windows - Versionsinfo "_
+ filename , MB_OK Or MB_ICONERROR)
End
EndIf
Dim As String Buffer = String(dwSize, 0)
If GetFileVersionInfo( filename, NULL, dwSize, StrPtr(Buffer) )= 0 Then
MessageBox (0, "Fehler, im Versionsinfo!", "Windows - Versionsinfo "_
+ filename , MB_OK Or MB_ICONERROR)
End
EndIf
Dim As Short Ptr xpFileInfo
Dim As ULong LenFileInfo
If VerQueryValue( StrPtr(Buffer),"\\", @xpFileInfo, @LenFileInfo )= 0 Then
MessageBox (0, "Fehler, im Versionsinfo!", "Windows - Versionsinfo "_
+ filename , MB_OK Or MB_ICONERROR)
End
EndIf
Anzeige = "FileVersion : " & Tb & _
*(xpFileInfo+5) & "." & *(xpFileInfo+4) & "." & _
*(xpFileInfo+7) & "." & *(xpFileInfo+6) & CrLf
Anzeige += "ProductVersion: " & Tb & _
*(xpFileInfo+9) & "." & *(xpFileInfo+8) & "." & _
*(xpFileInfo+11) & "." & *(xpFileInfo+10) & CrLf & CrLf
' CodePage und LanguageID auslesen
Dim As Long Ptr pvInfo
Dim As Long wInfoLen
VerQueryValue(StrPtr(Buffer),"\\VarFileInfo\\Translation", @pvInfo,@wInfoLen )
Dim As String Lang_String = Hex(*pvInfo And &hffff, 4) + Hex(*pvInfo Shr 16, 4)
Dim As String VerInfo(17) = {"CompanyName","FileDescription", _
"FileVersion","InternalName","LegalCopyright","OriginalFileName", _
"LegalTrademarks","PrivateBuild","SpecialBuild", _
"ProductName","ProductVersion","Comments","Language", _
"Email","Website","Special","Schöne Grüße","FreeBASIC"}
'In früheren Winversionen konnten eigene Versioninformationen definiert werden.
Dim As String Buffer2
For i As Long = 0 To 17
If VerQueryValue(StrPtr(Buffer), _
"\\StringFileInfo\\" + Lang_String + "\\" + VerInfo(i), _
@pvInfo, @wInfoLen) <> 0 Then
Buffer2 = String(wInfoLen, 0)
lstrcpy Buffer2, Cast(LPTSTR,pvInfo)
Anzeige += VerInfo(i) + " :" + Tb + Buffer2 + CrLf
End If
Next
MessageBox (0, Anzeige, "Windows - Versionsinfo " + filename , MB_OK)
Zusätzliche Informationen und Funktionen | |||||||
---|---|---|---|---|---|---|---|
|