Board index » delphi » Registry Up one Level

Registry Up one Level

With files, c:\windows\..\autoexec.bat will point to c:\autoexec.bat.
Unfortunatley, HKEY_LOCAL_MACHINE\software\microsoft\..\ will not point to
H_L_M\software.

Can somebody suggest a way of opening the up one level key in the Registry?

TiA

 

Re:Registry Up one Level


If anyone knows an easier solution I'd appreciate to know:

uses
  SysUtils, Registry;

function OpenParentKey(caReg: TRegistry; baCloseOpenKey: Boolean =
True): Boolean;
var
  slPath: string;
begin
  slPath := caReg.CurrentPath;
  slPath[Length(slPath)] := #0;  { Get rid of a possible trailing
backslash }
  Delete(slPath,StrRScan(PChar(slPath),'\') - PChar(slPath) + 1,MaxInt);
  if baCloseOpenKey then
    caReg.CloseKey ;
  Result := caReg.OpenKey(slPath,False);
end;

Gerhard

Quote
Sean Hamilton wrote:

> With files, c:\windows\..\autoexec.bat will point to c:\autoexec.bat.
> Unfortunatley, HKEY_LOCAL_MACHINE\software\microsoft\..\ will not point to
> H_L_M\software.

> Can somebody suggest a way of opening the up one level key in the Registry?

> TiA

--
---------------------------------------------------------------------
Dr. Gerhard Grosse       Phone:   +49 89 289-12567
Physik-Department E15    Fax:     +49 89 3206780
TU Muenchen              E-mail:  ggro...@ph.tum.de
D-85747 Garching         http://srv.e15.physik.tu-muenchen.de/grosse/
Germany
---------------------------------------------------------------------

Other Threads