'Der nachfolgenden Funktion muss beim Aufruf
'der Name des Abzufragenden Systems über-
'geben werden.
'Für das Lokale System geben sie bitte einen
'Punkt . ein.
'
'Die die Funktion benötigt ein Listview
'auf einem Formular mit Namen ListView1
'
'Aufruf beim Laden des Formulars:
'
'
LocalCodecsInfo(".")
Public Function LocalCodecsInfo(ByVal strComputer As String) As boolean
Try
Me.ListView1.Clear()
Catch ex As Exception
End Try
Dim options As ConnectionOptions
options = New ConnectionOptions()
Dim scope As ManagementScope
scope = New ManagementScope( _
"\\" & strComputer & "\root\cimv2")
scope.Connect()
' Query system for Operating System information
Dim query As ObjectQuery
query = New ObjectQuery( _
"SELECT * FROM Win32_CodecFile")
Dim searcher As ManagementObjectSearcher
searcher = New ManagementObjectSearcher(scope, query)
Dim queryCollection As ManagementObjectCollection
queryCollection = searcher.Get()
Dim m As ManagementObject
Dim str As String = String.Empty
Me.ListView1.Columns.Add("Name", 10, HorizontalAlignment.Left)
Me.ListView1.Columns.Add("Version", 10, HorizontalAlignment.Left)
Me.ListView1.Columns.Add("Group", 10, HorizontalAlignment.Left)
Me.ListView1.Columns.Add("Drive", 10, HorizontalAlignment.Left)
Me.ListView1.Columns.Add("Manufacturer", 10, HorizontalAlignment.Left)
Me.ListView1.Columns.Add("Archive", 10, HorizontalAlignment.Left)
Me.ListView1.Columns.Add("Encrypted", 10, HorizontalAlignment.Left)
Me.ListView1.Columns.Add("Extension", 10, HorizontalAlignment.Left)
Me.ListView1.Columns.Add("Filename", 10, HorizontalAlignment.Left)
Me.ListView1.Columns.Add("Filetype", 10, HorizontalAlignment.Left)
Me.ListView1.Columns.Add("Status", 10, HorizontalAlignment.Left)
For Each m In queryCollection
'Display the remote computer information
Dim lvi As New ListViewItem
lvi.Text = m("Name").ToString
Try
lvi.SubItems.Add(m("Version").ToString)
Catch ex As Exception
lvi.SubItems.Add("")
End Try
Try
lvi.SubItems.Add(m("Group").ToString)
Catch ex As Exception
lvi.SubItems.Add("")
End Try
Try
lvi.SubItems.Add(m("Drive").ToString)
Catch ex As Exception
lvi.SubItems.Add("")
End Try
Try
lvi.SubItems.Add(m("Manufacturer").ToString)
Catch ex As Exception
lvi.SubItems.Add("")
End Try
Try
lvi.SubItems.Add(m("Archive").ToString)
Catch ex As Exception
lvi.SubItems.Add("")
End Try
Try
lvi.SubItems.Add(m("Encrypted").ToString)
Catch ex As Exception
lvi.SubItems.Add("")
End Try
Try
lvi.SubItems.Add(m("Extension").ToString)
Catch ex As Exception
lvi.SubItems.Add("")
End Try
Try
lvi.SubItems.Add(m("FileName").ToString)
Catch ex As Exception
lvi.SubItems.Add("")
End Try
Try
lvi.SubItems.Add(m("Filetype").ToString)
Catch ex As Exception
lvi.SubItems.Add("")
End Try
Try
lvi.SubItems.Add(m("Status").ToString)
Catch ex As Exception
lvi.SubItems.Add("")
End Try
Me.ListView1.Items.Add(lvi)
Application.DoEvents()
Next
For Each locColumn As ColumnHeader In Me.ListView1.Columns
locColumn.Width = -2
Next
End Function