3
votes

I can't find out where the Registry constants are stored. In the following example, KEY_WRITE is not recognised, nor is HKEY_LOCAL_MACHINE .

And is there any decent help available for XE3 - the 'old' Delphi help was much more helpful!

uses System.Win.Registry;
...
...
...
...
reg := TRegistry.Create(KEY_WRITE);
1

1 Answers

7
votes

Add the Winapi.Windows unit to your uses clause:

uses
  Winapi.Windows, System.Win.Registry;

The next time you'll be missing a certain symbol, note that you can search for it using your favorite file browser by searching in the ..\Source directory of your Delphi installation path. If you will refine the search for only *.pas files and whole words only, you'll get e.g. for your KEY_WRITE symbol 3 files, where this symbol exists:

..\Source\data\dsnap\Datasnap.DataBkr.pas
..\Source\rtl\common\System.Win.ComObj.pas
..\Source\rtl\win\Winapi.Windows.pas

Then if you open those 3 files and look how the symbol is used there, you'll find, that it's defined in the Winapi.Windows.pas file and in the remaining two files is used just in certain function calls.