LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

regreadstring trouble

I am trying to read a regitry entry to determine a comport that a USB to serial adapter is located.
 
 
 status = RegReadString (REGKEY_HKLM,
       "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Enum\FTDIBUS\VID_0403+PID_6001+5&3278073a&0&1\0000\Device Parameters",
       "PortName", reg_string, 256, &value);
 
Keep receiving reg_string=" ' "  instead of  COM3
 
and the value=2089970366
 
Not sure what I am doing wrong.  Am I supposed to copy the entire SUBKEY name or just part of it.
 
Secondly teh VID_0403+PID_6001+5&3278073a&0&1 part of the key changes from machine to machine so how can you deal with that, is there some way to wildcard that part?
0 Kudos
Message 1 of 4
(3,822 Views)

It seems to me that you are duplicating part of the key address: since you have put REGKEY_HKLM as the first parameter, you do not need to start key address with HKEY_LOCAL_MACHINE which doubles this information. With this string the instruction is searching for a key addressed as HKEY_LOCAL_MACHINE\HKEY_LOCAL_MACHINE\SYSTEM\.... Smiley Surprised

Regarding your second question, you can simply place this part of the string inside a configuration file or some key in the registry (I normally use HKEY_LOCAL_MACHINE\Software\CompanyName\ProgramName key for these informations) and build up the final string with some fixed parts and this variable part, to be filled up only once manually after discovering its exact value in the actual machine the application is running.



Proud to use LW/CVI from 3.1 on.

My contributions to the Developer Community
________________________________________
If I have helped you, why not giving me a kudos?
0 Kudos
Message 2 of 4
(3,814 Views)

Thanks for the feedback.

Regarding determining the string.  When this application is deployed I can not request the user to determine the string.  I believe this is what you were suggesting doing?

I am correct or can this be determined on the fly by the program?

 

 

 

0 Kudos
Message 3 of 4
(3,810 Views)
You're right, I was imagining that you had in your hand the target machine to configure.
If you need to automate this part you could use enumerate keys inside HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Enum\FTDIBUS key. Unfortunately inside the Programmer's toolbox there is no function for enumerating subkeys, so you will need to directly use SDK function RegEnumKey to scan the stated key searching for actual configuration. You could use RegEnumerateValue as a framework to develop your function. Of course, you will need to set a criterion to select among the various resources found in the registry key.

Message Edited by Roberto Bozzolo on 03-27-2007 04:59 PM



Proud to use LW/CVI from 3.1 on.

My contributions to the Developer Community
________________________________________
If I have helped you, why not giving me a kudos?
0 Kudos
Message 4 of 4
(3,798 Views)