Sub Globals
Dim subKeys(0),values(0)
Dim id, fn
End Sub
Sub App_Start
Form1.Show
Reg.New1
Reg.RootKey(Reg.rtLocalMachine)
If Not(cPPC) Then
MsgBox("This application is not supported on the desktop.")
AppClose
End If
al1.Clear 'for repeated queries
subKeys() = Reg.GetSubKeyNames("Drivers\Active") 'Gets the list of active drivers.
For i = 0 To ArrayLen(SubKeys())-1
values() = Reg.GetValueNames("Drivers\Active\" & subKeys(i))
For i2 = 0 To ArrayLen(values())-1
If values(i2) = "Name" Then 'Checks if Name value exists.
name = Reg.GetValue("Drivers\Active\" & subKeys(i),"Name")
If SubString(name,0,3) = "COM" Then 'Checks if the driver name starts with COM.
key = Reg.GetValue("Drivers\Active\" & subKeys(i),"Key")
fn = reg.GetValue(key,"FriendlyName")
id = Reg.GetValue("Drivers\Active\" & subKeys(i),"PnpId")
If fn = "" Then fn = key 'Use Key if no FriendlyName available
If StrLength(id) > 0 Then fn = "" 'Prefer PnpId over Key'
al1.Add(name & " " & fn & id) 'Gets the FriendlyName value and PnpId, if available.
End If
Exit
End If
Next
Next
al1.Sort(cCaseUnsensitive) 'Sorts the values.
ListBox1.Clear 'for repeated queries
For i = 0 To al1.Count-1
ListBox1.Add(al1.Item(i)) 'Adds the values to the ListBox.
Next
End Sub