Is there a C API equivalent for the Ruby API's read_default and write_default?

On Windows that value is stored as a DWORD which these API methods could never handle.
So it always returns nil in those cases.

These methods can only read string values, but they Ruby eval them so this often causes errors, ie:

Sketchup.read_default("Settings","Shortcut_1").inspect

#=> Error: #<SyntaxError: <main>: syntax error, unexpected tINTEGER, expecting end-of-input
#=> 0 0 0 H selectDollyTool:
#=>    ^>
#=> <main>:1:in `eval'

And there is no way to intercept the error and get the pre eval string value because it seems this is done on the C-side.


Attempting to use these methods to write to non-extension key hives is asking for a corrupt registry and a SketchUp reinstall.

Better to use WIN32OLE or stdlib’s Win32::Registry class (require "win32/registry").


and we’re a bit off the topic here as this is about using the C SDK.