LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

how to read registry value?

I know there are Windows Registry Access VIS in Labview. But i donnot know how to arrange these vi and i cannot find any example about accessing Registry value in LV. So could you help me make a example about how to read registry value ? For example, how to read the friendlyname of Hardisk in the attached picture ? I use Labview 6.1 version. Thank u so much !
0 Kudos
Message 1 of 11
(9,092 Views)
I've looked for examples for reading registry keys and they are hard to find. I'm attaching a screen shot of an example I happen to have developed awhile back. It's for reading the text string in the Windows screensaver "3D Text (OpenGL)". The string constant for your example will be considerably longer than this, but it illustrates the point.

My example is in LV7.1, but I think the registry function are identical to those used in LV6.1.
0 Kudos
Message 2 of 11
(9,089 Views)
Thanks! But short registry access is OK. while in my case, the path of registry access is long, so the labview deny it. You can see the attached picture ! Any idea ?
0 Kudos
Message 3 of 11
(9,078 Views)


@shenzhengpib wrote:
Thanks! But short registry access is OK. while in my case, the path of registry access is long, so the labview deny it. You can see the attached picture ! Any idea ?




Not sure what might be the problem but if it is the size of the registry key and not a syntax error (with those many underscores it seems hard to me to get it completely right) you can do a two step approach. Error -604 doesn't sound like a to long path error but it may be a misreported error really.
Just use the two enclosed VIs to implement an approach as is pointed out in the attached Test Registry VI. Please note that you have to replace the standard Close Registry.vi with the one in the archive, as otherwise you get errors when closing intermediate keys.

Rolf Kalbermatter
Rolf Kalbermatter  My Blog
DEMO, Electronic and Mechanical Support department, room 36.LB00.390
0 Kudos
Message 4 of 11
(9,071 Views)
The error message is a permissions issue. Attached is my solution, though I'm not clear on what you are trying to accomplish as the subkey name has the drive name that you are looking for imbedded within it.
0 Kudos
Message 5 of 11
(9,048 Views)


@RLD wrote:
The error message is a permissions issue. Attached is my solution, though I'm not clear on what you are trying to accomplish as the subkey name has the drive name that you are looking for imbedded within it.




You are right that it is a permission error message but it is one about the remote registry not being available. This sounds a little odd to me as the access is clearly on the local machine so no remote registry is involved. My thought was that maybe the internal ASCII to Unicode translation (LabVIEW calls the ASCII function but the entire registry is in Unicode implemented) might be limited by some arbitrary number of characters (in Windows system DLLs code this usually is MAX_PATH or 260 chars). Splitting up the opening of a key in two parts would possibly aleviate such a length limit problem. But I'm not sure if that is the case at all. There might be really a different error internally but the Win32 to LabVIEW error translator may create a bogus translation. Only tests on the actual machine with single stepping into the registry VIs would give more details here.

Rolf Kalbermatter
Rolf Kalbermatter  My Blog
DEMO, Electronic and Mechanical Support department, room 36.LB00.390
0 Kudos
Message 6 of 11
(9,038 Views)
I agree, this can only be resolved on the actual machine. However, both on a XP and on a Win2K machine, I get the -604 error when the "security access mask" is KEY_READ | KEY_WRITE (the unwired default). Changing it to KEY_READ or, as in my screen shot, KEY_QUERY_VALUE the VI works with no error.
0 Kudos
Message 7 of 11
(9,019 Views)
What about Write value or Set value.  I'm getting this error now.  I'm using Vista...
0 Kudos
Message 8 of 11
(8,149 Views)

You can not write anywhere in the registry under Windows Vista except the current user hive, without administrator rights. Thightened up security has its price.

 

Rolf Kalbermatter

Rolf Kalbermatter  My Blog
DEMO, Electronic and Mechanical Support department, room 36.LB00.390
Message 9 of 11
(8,109 Views)

In other words the LV registry write functions are made obselete as of Vista..

 

I've found that the Vista Virtualisation method of accepting registery write operations to be unreliable.

0 Kudos
Message 10 of 11
(8,059 Views)