![]() |
Tipp 0069
|
Version einer DLL, OCX oder EXE ermitteln
|
 |
|
Autor/Einsender: Datum: |
|
Michael Werner 21.02.2005 |
|
Entwicklungsumgebung: |
|
VB.Net 2003 |
Framework: |
|
1.1 |
|
|
Mit der Klasse FileVersionInfo kann die Datei-Version von
exe-, dll- und ocx-Dateien ausgelesen werden.
|
|
|
Imports System.IO
Imports System.Text
Public Class Form1
Inherits System.Windows.Forms.Form Vom Windows Form Designer generierter Code
Dim SysDir As String = Environment.SystemDirectory
Private Sub GetVersion(ByVal sFilePath As String)
Dim Version As FileVersionInfo = _
FileVersionInfo.GetVersionInfo(sFilePath)
ListBox1.Items.Clear()
With Version
ListBox1.Items.Add(.FileVersion.ToString)
ListBox1.Items.Add(.FileMajorPart.ToString)
ListBox1.Items.Add(.FileMinorPart.ToString)
ListBox1.Items.Add(.FileBuildPart.ToString)
ListBox1.Items.Add(.FilePrivatePart.ToString)
ListBox1.Items.Add(.FileDescription)
ListBox1.Items.Add(.ProductName)
ListBox1.Items.Add(.LegalCopyright)
ListBox1.Items.Add(.SpecialBuild)
End With
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles Button2.Click
TextBox1.Text = Durchsuchen()
If TextBox1.Text <> "" Then
GetVersion(TextBox1.Text)
End If
End Sub
Private Function Durchsuchen() As String
Dim myStream As Stream
Dim OpenFileDialog1 As New OpenFileDialog
Dim sb As New System.Text.StringBuilder
With OpenFileDialog1
.InitialDirectory = SysDir
With sb
.Append("*.dll,*.ocx,*.exe")
.Append("|*.dll")
.Append(";*.ocx")
.Append(";*.exe")
End With
.Filter = sb.ToString
.RestoreDirectory = True
If .ShowDialog() = DialogResult.OK Then
Return .FileName
End If
End With
End Function
Private Sub Button1_Click(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles Button1.Click
Me.Close()
End Sub
End Class
|
|
|
|
|
Windows-Version |
98/SE |
 |
|
ME |
 |
|
NT |
 |
|
2000 |
 |
|
XP |
 |
|
Vista |
 |
|
Win
7 |
 |
|
|
|
Download (6,6
kB)
|
Downloads bisher: [ 730 ]
|
|
|