New account

Accessing the Registry  Bottom

  • 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?

    Form1: TForm1;
    RegFile: tcRegistry;


    Procedure TForm1.Form1OnSetupShow (Sender: TObject);
    RegStrings : TStrings;
    i : integer;

    // 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
    ListBox1.Items[i] := RegStrings[i];


    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.


  • 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);

  • 0 users

This list is based on users active over the last 30 minutes.