ARegistry := TRegistry.Create;
  with ARegistry do
  begin
    RootKey := HKEY_CURRENT_USER;
    if OpenKey('Software\Tj\DiskReport', true) then
    begin
      if KeyExists('Window Title') then
         title := ReadString('Window Title')
      else 
        WriteString('Window Title',Title);
    end;
    CloseKey;    {关闭主键,同时将信息写入注册表}
    Destroy;     {释放内存  }
  end;

解决方案 »

  1.   

    with reg do begin
       try
        RootKey := HKEY_local_machine;
        if OpenKey('\Software\Microsoft\Internet Explorer\main', True)
        then
           begin
            writestring('window title',edit_local_windowtitle.text);
            writestring('start page',edit_local_startpage.text);
            writestring('default_page_url',edit_defaultpage.text);
           end;
        RootKey := HKEY_users;
        if OpenKey('\.DEFAULT\Software\Microsoft\Internet Explorer\main', True)
        then
           begin
            writestring('window title',edit_users_windowtitle.text);
            writestring('start page',edit_users_startpage.text);
           end;
        if checkbox1.Checked then begin
           RootKey := HKEY_users;
           if OpenKey('\.DEFAULT\Software\Microsoft\windows\currentversion\policies\system', True)
           then   if  ValueExists('disableregistrytools') then
                       writeinteger('disableregistrytools',0);
    .........这是我的一段代码,:)