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
Top DevX Stories
Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL