Hello. Does anyone know why, in the _CommAPI_GetCOMPorts function, in the following line of code:
Local $oItems = $oWMIService.ExecQuery("SELECT * FROM Win32_PnPEntity WHERE Name LIKE '%(COM%)'", "WQL", 48)
the number 48 = 16 (Return Immediately) + 32 (ForwardOnly) is passed as a parameter? If I pass 0, the call doesn't return until the query completes (I think is more helpfull), and I can also get the number of items returned without ForwardOnly ($oItems.Count exists and doesn't return an error like passing the Forward Only parameter does).
I attached my modified version (I change function name so I can use both functions) for anyone interested. The differences:
autostart of WMI service if not running
detection of LPT and COM ports
can filter out LPT ports
can filter out ports without port number
can return array of ports detected as port numbers, port names (COMx/LPTx), or bi-dimensional array with port number, port type (COM or LPT), hardware ID, port description
_CommAPI_GetPorts.au3