|
| 1 | +Uses "CONSOLE" |
| 2 | +Uses "WMI" |
| 3 | +Uses "OS" |
| 4 | + |
| 5 | +Global hComm As Long |
| 6 | +Global nBytes As Long |
| 7 | +Global sBuffer As String |
| 8 | +Global gPortOpen As Boolean |
| 9 | +Global pID As Number |
| 10 | +Global vData() As String |
| 11 | +Global nItems As Long |
| 12 | +Global Counter As Long |
| 13 | +Global Position As Long |
| 14 | +Global ComputerName As String Value OS_GetComputerName |
| 15 | +Global Ports() As String |
| 16 | +Global CountATI As Long |
| 17 | +Global sHexFilename As String |
| 18 | +Global sFirmwareNumber As String |
| 19 | +Global bConsole As Boolean |
| 20 | +Global bUpdaterConsole As Boolean |
| 21 | +Global sCommandLine As String |
| 22 | + |
| 23 | + |
| 24 | +sBuffer = WMI_GetData(ComputerName, "", "", "", "Win32_PnPEntity", "", "Caption" ) |
| 25 | + |
| 26 | +Console_WriteLine(sBuffer) |
| 27 | + |
| 28 | +WaitKey |
| 29 | + |
| 30 | +'nItems = Parse( sBuffer, vData(), $CRLF) |
| 31 | + |
| 32 | + |
| 33 | + |
| 34 | +' ReDim Ports() |
| 35 | + |
| 36 | +' For Counter = 1 To nItems |
| 37 | +' Position = InStr(Ucase$(vData(Counter)),"(COM") |
| 38 | +' If Position Then |
| 39 | +' ReDim Preserve Ports(UBound(Ports)+1) |
| 40 | +' PortS(UBound(Ports)) = Extract$(Position+1,vData(Counter),")") |
| 41 | +' End If |
| 42 | +' Next |
| 43 | + |
| 44 | + ' Check for no COM ports found |
| 45 | +' If LBound(Ports) = 0 And UBound(Ports) = 0 Then |
| 46 | +' Control Append Text CBHNDL, %ID_CommandOutputTexBox, "No COM ports found on this computer. Click Exit." + Chr$(13) + Chr$(10) |
| 47 | +' Else |
| 48 | +' Control Append Text CBHNDL, %ID_CommandOutputTexBox, "Found the following ports:" + Chr$(13) + Chr$(10) |
| 49 | +' For Counter = LBound(Ports) To UBound(Ports) |
| 50 | +' Control Append Text CBHNDL, %ID_CommandOutputTexBox, Ports(Counter) + Chr$(13) + Chr$(10) |
| 51 | +' Next |
| 52 | +' For Counter = LBound(Ports) To UBound(Ports) |
| 53 | +' hComm = COMM_FreeFile |
| 54 | +' Control Append Text CBHNDL, %ID_CommandOutputTexBox, "Testing port " & Ports(Counter) & " ... " |
| 55 | +' COMM_Open("\\.\" & Ports(Counter), hComm) |
0 commit comments