Returns information about the current key. type
  TRegKeyInfo = record    NumSubKeys: Integer;
    MaxSubKeyLen: Integer;
    NumValues: Integer;
    MaxValueLen: Integer;
    MaxDataLen: Integer;
    FileTime: TFileTime;  end;function GetKeyInfo(var Value: TRegKeyInfo): Boolean;DescriptionCall GetKeyInfo to return all information about the current key to an application. Value is a variable declared in an application to store the key information returned by this function. Value must be of type TRegKeyInfo. Information returned by GetKeyInfo about the current key includes:Number of subkeys
Longest subkey name length, in characters
Number of data values
Longest data-value name length
Longest data-value length
Time of last write to the keyOn success GetKeyInfo returns True. On failure it returns False, and the Value record is set to zeroes.

解决方案 »

  1.   

    Returns a string list containing the names of all subkeys belonging to the current key.procedure GetKeyNames(Strings: TStrings);DescriptionCall GetKeyNames to determine the names of all subkeys belonging to the current key. Determining the names of subkeys is useful in an application that iterates through a set of keys.Strings is a variable of type TStrings into which to return the list of subkey names.Returns a string list containing the names of all data values associated with the current key.procedure GetValueNames(Strings: TStrings);DescriptionCall GetValueNames to determine the names of all data values associated with the current key. Determining the names of data values is useful in an application that iterates through a set of data values for a key.Strings is a variable of type TStrings into which to return the list of data value names.
    以上三个函数配合使用,将可以满足你的要求
      

  2.   

    procedure TForm1.WMEndSession(var Message: TWMEndSession);
    var
      Reg: TRegistry;
    begin
      Reg := TRegistry.Create;
      try
        Reg.RootKey := HKEY_CURRENT_USER;
        if Reg.OpenKey('\Software\Microsoft\Windows\CurrentVersion\RunOnce', True) then
       begin
          Reg.WriteString('MyApp','"' + ParamStr(0) + '"');
          Reg.CloseKey;
        end;
      finally
        Reg.Free;
        inherited;
      end;end;
      

  3.   

    procedure TForm1.Button1Click(Sender: TObject);
    var
      Reg: TRegistry;
      Val:TStringList;
      I:Integer;
    begin
      Reg:=TRegistry.Create;
      try
        Val:=TStringList.Create;
        try
          Reg.RootKey:=HKey_Local_Machine; 
          if not Reg.OpenKey(Edit1.Text,False) then
            ShowMessage('Error opening key')
          else
          begin
            Reg.GetValueNames(Val);        for I:=0 to Val.Count-1 do
            begin
              ShowMessage(Edit1.Text + Chr(13) +
                          'has an Entry Called '+Val.Strings[I]+Chr(13)+
                          'With a Value of '+Reg.ReadString(Val.Strings[I]));
            end;
            if MessageDlg('Ok to delete the key and lose all these values?'
                        ,Mtinformation,[mbYes,mbNo],0)=mryes then
              Reg.DeleteKey(Edit1.Text);      end;
        finally
          Val.Free;
        end;
      finally
        Reg.Free;
      end;
    end;
    别人写的,那里骗点分