Accessing the Registry
-
- Registered: May 27, 2007
- Last visit: Jun 01, 2007
- Posts: 1
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
-
- Registered: Dec 04, 2006
- Last visit: Dec 29, 2011
- Posts: 89
Hello!
You find a example in the unit uSysInfo Function "tcSysAppInfo.getOdinPEExe"
By RegFile.ReadSection you do not need to fill the Parameter "Section".
e.g. RegFile.ReadSection('', RegStrings);
bye,
Wolfgang
- Moderated by:
- Admins-Forum
Users on-line
- 0 users
This list is based on users active over the last 30 minutes.