to list available COMM Ports in Visual Basic
I am trying to list out the available ports on the machine using the registry
functions in VB. But the i get an error even while opening the registry.
I have given the code i am using below. If you could find anything wrong
with it please reply.
Dim hKey As Long ' receives a handle to the newly created or opened registry
Dim stringbuffer As String ' receives data read from the registry
Dim databuffer(1000) As Byte ' receives data type of read value
Dim slength As Long, dlength As Long, tbuffer As Long ' receives length of
Dim retval As Long ' return value
' Create or open the registry key
retval = RegOpenKeyEx(HKEY_LOCAL_MACHINE, "Hardware\\DeviceMap\\SerialComm",
0, KEY_ALL_ACCESS, hKey)
If retval <> 0 Then
Debug.Print "ERROR: Unable to open registry key!"
retval = RegEnumValue(hKey, i, stringbuffer, slength, 0&, REG_SZ, databuffer(0),
If retval = 0 Then
-- Android Development Center
-- Cloud Development Project Center
-- HTML5 Development Center
-- Windows Mobile Development Center