Hi All
Never having attempted accessing the Registry before I had a read through a Delphi book to get some ideas and had a hunt through the WDSibyl library source files to see what is supported.
Looks like inifiles.pas provides Registry access but I am having a few problems working out how to use the code - probably getting a bit confused with what I read in the Delphi book.
What I want to do initially is read the application names stored below the key
HKEY_LOCAL_MACHINE\Software\InnoTek\InnoTek Font Engine\Applications
and display them in a ListBox. I also want to discover if they are Enabled.
I guess that as with an INI file it is necessary to Declare a var and then Create an instance?
Var
Form1: TForm1;
RegFile: tcRegistry;
Implementation
Procedure TForm1.Form1OnSetupShow (Sender: TObject);
var
RegStrings : TStrings;
i : integer;
Begin
// Code to read Registry and display existing applications in ListBox1
RegFile.Create(taeKEY_LOCAL_MACHINE, '\Software\InnoTek\InnoTek Font Engine\Applications');
RegFile.ReadSection('HKEY_LOCAL_MACHINE\Software\InnoTek\InnoTek Font Engine\Applications', RegStrings);
For I := 0 to ListBox1.Items.Count-1 do
Begin
ListBox1.Items[i] := RegStrings[i];
End;
End;;
The above code compiles but on Running produces an error:-
Exception occured: Cannot open ini-file. RegOpenKeyEx=2 at $0004E9B3
Looks like the ini file cannot be opened; I'm obviously doing something wrong - but what?
Any snippets of code showing read and write access to the Registry would be appreciated.
Regards
Pete