String*127

I’m trying to write some code to read a value from the registry using RegQueryValueEx. The value I’m trying to get is type REG_DWORD which is a 32-bit number. It works fine for regular text values (REG_SZ), but I want to get the numeric value that seems to be coming across as an ASCII string with the hex/binary value that I’m trying to capture. The code I found to do this uses

Dim strValue as String*127

and even though it sort of works, I only partially understand what it means and I have only figured out how to translate one “character” with the returned data. I can’t search for an answer because the asterisk doesn’t work in any of the search engines I’ve used. Can anyone either explain this or at least give me a link where I can read about it? Thanks in advance!

Subject: Look at the String data type

Using the declaration

Dim StrVar as String*127

means that you are declaring a String type variable, with the fixed length of 127 characters. The variable is initialized with NULL to the length of the string.

Not having used these functions for reading the registry, my guess is that you’ll have get the ASCII value for the first 4 bytes of the returned string, and put them together to a 32-bit integer manually.

/Peter