Ik ben een installatie aan het maken voor een vfd driver, ik ben zover dat ik kan zien welke lpt en com poorten er aanwezig zijn en of er usb aanwezig is:
On Error Resume Next
USB = 0
COM1 = 0
COM2 = 0
COM3 = 0
COM4 = 0
COM5 = 0
COM6 = 0
COM7 = 0
COM8 = 0
LPT1 = 0
LPT2 = 0
LPT3 = 0
strComputer = "."
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
Set colItems = objWMIService.ExecQuery("Select * from Win32_PortConnector",,48)
For Each objItem in colItems
if Left(objItem.ExternalReferenceDesignator, 3) = "USB" then USB = 1
if objItem.InternalReferenceDesignator = "LPT1" then LPT1 = 1
if objItem.InternalReferenceDesignator = "LPT2" then LPT2 = 1
if objItem.InternalReferenceDesignator = "LPT3" then LPT3 = 1
Next
Set colItems = objWMIService.ExecQuery("Select * from Win32_SerialPortConfiguration",,48)
For Each objItem in colItems
if objItem.Caption = "COM1" then COM1 = objItem.BaudRate
if objItem.Caption = "COM2" then COM2 = objItem.BaudRate
if objItem.Caption = "COM3" then COM3 = objItem.BaudRate
if objItem.Caption = "COM4" then COM4 = objItem.BaudRate
if objItem.Caption = "COM5" then COM5 = objItem.BaudRate
if objItem.Caption = "COM6" then COM6 = objItem.BaudRate
if objItem.Caption = "COM7" then COM7 = objItem.BaudRate
if objItem.Caption = "COM8" then COM8 = objItem.BaudRate
Next
Wscript.Echo "USB = " & USB
Wscript.Echo "COM1 = " & COM1
Wscript.Echo "COM2 = " & COM2
Wscript.Echo "COM3 = " & COM3
Wscript.Echo "COM4 = " & COM4
Wscript.Echo "COM5 = " & COM5
Wscript.Echo "COM6 = " & COM6
Wscript.Echo "COM7 = " & COM7
Wscript.Echo "COM8 = " & COM8
Wscript.Echo "LPT1 = " & LPT1
Wscript.Echo "LPT2 = " & LPT2
Wscript.Echo "LPT3 = " & LPT3
Die echo's zijn voor test, straks worden deze als properties in mijn installer gezet.
Ook is het mogelijk met wmi port resources uit te lezen, echter zie ik dan alle resources maar niet waar ze aan gekoppeld zijn. Hoe kan ik het portaddress van een LPT poort uitlezen? Google en got search geven een heleboel over programatische aansturing van LPT poorten, maar niets over het uitlezen van de settings.
On Error Resume Next
USB = 0
COM1 = 0
COM2 = 0
COM3 = 0
COM4 = 0
COM5 = 0
COM6 = 0
COM7 = 0
COM8 = 0
LPT1 = 0
LPT2 = 0
LPT3 = 0
strComputer = "."
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
Set colItems = objWMIService.ExecQuery("Select * from Win32_PortConnector",,48)
For Each objItem in colItems
if Left(objItem.ExternalReferenceDesignator, 3) = "USB" then USB = 1
if objItem.InternalReferenceDesignator = "LPT1" then LPT1 = 1
if objItem.InternalReferenceDesignator = "LPT2" then LPT2 = 1
if objItem.InternalReferenceDesignator = "LPT3" then LPT3 = 1
Next
Set colItems = objWMIService.ExecQuery("Select * from Win32_SerialPortConfiguration",,48)
For Each objItem in colItems
if objItem.Caption = "COM1" then COM1 = objItem.BaudRate
if objItem.Caption = "COM2" then COM2 = objItem.BaudRate
if objItem.Caption = "COM3" then COM3 = objItem.BaudRate
if objItem.Caption = "COM4" then COM4 = objItem.BaudRate
if objItem.Caption = "COM5" then COM5 = objItem.BaudRate
if objItem.Caption = "COM6" then COM6 = objItem.BaudRate
if objItem.Caption = "COM7" then COM7 = objItem.BaudRate
if objItem.Caption = "COM8" then COM8 = objItem.BaudRate
Next
Wscript.Echo "USB = " & USB
Wscript.Echo "COM1 = " & COM1
Wscript.Echo "COM2 = " & COM2
Wscript.Echo "COM3 = " & COM3
Wscript.Echo "COM4 = " & COM4
Wscript.Echo "COM5 = " & COM5
Wscript.Echo "COM6 = " & COM6
Wscript.Echo "COM7 = " & COM7
Wscript.Echo "COM8 = " & COM8
Wscript.Echo "LPT1 = " & LPT1
Wscript.Echo "LPT2 = " & LPT2
Wscript.Echo "LPT3 = " & LPT3
Die echo's zijn voor test, straks worden deze als properties in mijn installer gezet.
Ook is het mogelijk met wmi port resources uit te lezen, echter zie ik dan alle resources maar niet waar ze aan gekoppeld zijn. Hoe kan ik het portaddress van een LPT poort uitlezen? Google en got search geven een heleboel over programatische aansturing van LPT poorten, maar niets over het uitlezen van de settings.
[ Voor 10% gewijzigd door |sWORDs| op 01-01-2005 18:13 ]
Te Koop:24 Core Intel Upgradeset