如题,如何修改一个注册表不中KEY 中的一个参数值 ,以及增加与册除KEY 的参数项,要求不要叫删除了KYE 后新建。

解决方案 »

  1.   

    RegSetValueEx
    RegCreateKeyEx
    RegDeleteKey
      

  2.   

    在Uses中加入Registry 单元下面是一个写注册表键值的例子:
    procedure TfrmPrintVouchIn.SavePageSet;
    var
      RegKey: TRegistry;
    begin
      RegKey := TRegistry.Create;
      try
        if RegKey <> nil then
        begin
          RegKey.RootKey := HKEY_CURRENT_USER;
          if RegKey.OpenKey('\Software\disburs\ZBAdjust\'+PrintKey,true) then
          begin
            RegKey.WriteString('TopMargin',edtTopMargin.Text);
            RegKey.WriteString('LeftMargin',edtLeftMargin.Text);
            RegKey.WriteString('Width',edtWidth.Text);
            RegKey.WriteString('Length',edtLength.Text);
            regKey.WriteString('Orientation',IntToStr(cbxOrientation.ItemIndex));
            RegKey.CloseKey;
          end;
        end;
      finally
        RegKey.Free;
      end;
    end;