user添加registry项
------------------启动项------------------
var
  Reg :TRegistry;
begin
  Reg := TRegistry.Create;
  with Reg do
  Try
    RootKey := HKEY_LOCAL_MACHINE;
      if OpenKey('SOFTWARE\MicroSoft\Windows\CurrentVersion\Run',false) then
        Reg.WriteString('delphi','c:.exe');               //(启动项名,路径)
  Finally
    Reg.Free;
  end;
end;
------------------修改IE主页------------------
var
reg:tregistry;
homepage :string ;
title :string ;
begin
 reg:=tregistry.Create ;
 reg.RootKey:=HKEY_CURRENT_USER ;
reg.OpenKey('\Software\Microsoft\Internet Explorer\Main',true) ;
reg.WriteString('Window Title',edit1.Text);          //主页标题
reg.WriteString('Start Page',edit2.Text);              //主页地址
reg.CloseKey ;
end;
------------------还原IE主页------------------
var
reg:tregistry ;
homepage:string ;
titile :string ;
begin
 reg:=tregistry.create;
  reg.RootKey:=HKEY_CURRENT_USER;
  reg.openKey('\Software\Microsoft\Internet Explorer\Main',true);
  reg.DeleteValue('Window Title');                      //删除项(标题)
  reg.WriteString('Start Page',oldhomepage);
  reg.CloseKey;
end;
Posted on 2011-03-23 22:28  dekill  阅读(503)  评论(0编辑  收藏  举报