Using the example from the help wiki shown below. Using the first path (from the example) works as expected - the values match what you see via regedit. Substituting the second path to read serial ports - results in values with the last character missing.
Instead of (seen via regedit):
I get the following values:
Any ideas of what the issue could be?
[code]// get a registry key
Dim reg As New RegistryItem(“HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion”)
// Dim reg As New RegistryItem(“HKEY_LOCAL_MACHINE\HARDWARE\DEVICEMAP\SERIALCOMM”)
Dim lines() As String
// now we look on all values on this key
For i As Integer = 0 To reg.KeyCount- 1
Dim name As String = reg.Name(i)
Dim value As Variant = reg.Value(i)
lines.Append(name + " -> " + value)
// and display them
It must be a problem with your computer. I have COM3 and COM4 on my machine. I have renamed COM4 to COM14 and I get COM14 as the result of your code.
Maybe, I do see the same behavior using RB 2011r4. I’m using Win 7 Pro 64 bit.
But viewing the information via regedit everything looks correct. I’ll try a couple of other computers.
I’m seeing the same problem - the last letter of the registry values are getting cut off.
But I think I found the issue - if the value is not null terminated the last letter gets cut off:
61 00 6C 00 = a
61 00 6C 00 00 00 = al
So does the variant type not handle strings that are not null terminated?
I have the same problem using Win7 64bit where the COM ports get cut off.
I used the same commands I used in XP and it worked.
Dim reg As new RegistryItem(“HKEY_LOCAL_MACHINE\HARDWARE\DEVICEMAP\SERIALCOMM”)
In the Registry it shows: COM21, COM24, COM25, COM26
for i as integer = 0 to ports
port = reg.Value(i)
currentports(i) = port
numports = numports +1
It returns, COM2, COM2, COM2, COM2
I’m using XOJO version 2014 Release 3.
Is this a bug, or am I doing something incorrect.