Quirks Writing to Registry

Hi all,

I just wanted to post to share some feedback and lessons learned that I recently had with writing to the registry - a few notes…

Note 1:
-If you have an existing Value in the Registry that you are trying to write to and the variable in your app is not the same type as the registry value, then the registry type will be changed.
Example: I was trying to write to a REG_DWORD using a string variable, which then changed my Registry Type to a REG_SZ (String).
Future hopes: Would be nice if Xojo instead returned an error or even let you specify exactly which registry type you want to use when writing to the registry.

Note 2:
-To further go down the road from Note 1, PAY VERY CLOSE ATTENTION to which variable type you are using in Xojo compared to what your desired Registry Type is. This is especially important depending on if you are compiling a 32bit app vs 64bit app.
Example: I was using a Xojo Integer Type variable to try to save to a REG_DWORD in the Registry. This would be fine compiling a 32bit app (because DWORD is a 32bit Integer) but if compiling a 64 bit app you MUST declare your Xojo Integer variable as Type Int32. Otherwise this will create or change the Registry Value to a REG_QWORD (64bit Integer).
Future hopes: Similar to Note 1, would be nice if there was some type of error about this or expanded documentation in the registry section of the online docs.

Would be interested to know if other people have had similar issues. Hopefully that this post might help someone else who is learning the nuances of Xojo.


I wonder if KeyType has to be set prior to supplying value.

Thanks for identifying that Rich. Unless I am mistaken, It looks like KeyType is only used when reading a registry value rather than writing it though.