LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Not a refnum not working oregistry

I need to check if a registry key exist:

 

michelesantucci_0-1730993869842.png

Unluckly not-a-number/path/refnum does not work on registry refnums ... it always returns FALSE regardless of whether the registry exists or not.

 

How can I check for registry key existence?

 

Best regards,

 Mike

 

0 Kudos
Message 1 of 3
(54 Views)

@michele.santucci wrote:

 

 

How can I check for registry key existence?

 

 


Obviously try to read your key and check Error Out instead of refnum.

0 Kudos
Message 2 of 3
(45 Views)

The registry key refnum is not a real refnum (well it actually is a queue refnum, but casted into a datalog refnum to hide the internal implementation and not let a user manipulate the content in the queue). The Is Not a Refnum node sees that the refnum is a datalog refnum and then queries the datalog cookie jar for validity and that cookie jar tells the function, no this is not a refnum that I ever have seen.

 

What usually works but isn't quite foolproof, is a comparison to be unequal to the Not a Refnum constant. The only foolproof way is to try to access the registry refnum, for instance by calling Query Registry Key Info.vi. If that returns an error -600, you got almost certainly an invalid refnum.

Rolf Kalbermatter
My Blog
0 Kudos
Message 3 of 3
(32 Views)