Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Com Ports.
Message
General information
Forum:
Visual FoxPro
Category:
Windows API functions
Title:
Miscellaneous
Thread ID:
00410211
Message ID:
00410310
Views:
22
>You can read from the register
>\HKEY_LOCAL_MACHINE\HARDWARE\DESCRIPTION\System \MultifunctionAdapter\0\SerialController\...
>

You have to iterate the MultifunctionAdapter subkeys; it isn't always on the 0th key. You also have problems with this approach where the serial port is provided through USB emulation or redirection of IRQ 14.

The easiest way to detect this is to iterate the port using MSComm and trap the error from PortOpen:
LOCAL oComm, i, cOldErrorHandler
DECLARE aComPorts[16]
aComPorts = .T.
cOldErrorHandler = ON('ERROR')
FOR i = 1 TO 16
  oComm = CREATE('MsCOMMLib.Mscomm')
  oComm.CommPort = i
  ON ERROR aComPorts[i] = .F.
  oComm.PortOpen = .t.
  oComm.PortOpen = .f.
  oComm = NULL
  ON ERROR &cOldErrorHandler
ENDFOR
The array aComPorts will have .t. for each available comm port.
EMail: EdR@edrauh.com
"See, the sun is going down..."
"No, the horizon is moving up!"
- Firesign Theater


NT and Win2K FAQ .. cWashington WSH/ADSI/WMI site
MS WSH site ........... WSH FAQ Site
Wrox Press .............. Win32 Scripting Journal
eSolutions Services, LLC

The Surgeon General has determined that prolonged exposure to the Windows Script Host may be addictive to laboratory mice and codemonkeys
Previous
Reply
Map
View

Click here to load this message in the networking platform