Einzelnen Beitrag anzeigen

Benutzerbild von Sprint
Sprint

Registriert seit: 18. Aug 2004
Ort: Edewecht
712 Beiträge
 
Delphi 5 Professional
 
#10

Re: Grösse in Bytes eines Keys der registry bekommen

  Alt 2. Feb 2005, 21:57
Delphi-Quellcode:
const
  S_KEYNAME = 'SOFTWARE\Borland\Delphi\7.0';
  S_VALUENAME = 'RootDir';
var
  CurrentKey: HKEY;
  Path: String;
  Size: DWORD;
begin

  if RegOpenKeyEx(HKEY_LOCAL_MACHINE, S_KEYNAME, 0, KEY_READ, CurrentKey) = ERROR_SUCCESS then
  begin
    SetLength(Path, MAX_PATH);
    Size := Length(Path);
    if RegQueryValueEx(CurrentKey, S_VALUENAME, nil, nil, PByte(PChar(Path)), @Size) = ERROR_SUCCESS then
    begin
      SetLength(Path, Size);
      ShowMessage(Path);
    end;
    RegCloseKey(CurrentKey);
  end;

end;
Ciao, Sprint.

"I don't know what I am doing, but I am sure I am having fun!"
  Mit Zitat antworten Zitat