var tt:integer; ss:Tstringlist; sss:string; begin reg:=Tregistry.Create; ss:=Tstringlist.Create; reg.RootKey:=HKEY_CURRENT_USER; if reg.OpenKey('SOFTWARE\Microsoft\Windows\CurrentVersion\Run',false) then begin sss:=memo1.Text; ss.Add(sss) ; for tt:=0 to ss.Count -1 do reg.DeleteValue(ss.Strings[tt]); end;
----------------------------------------------
-
在删除! function delthekey(mainkey : Longint; Key : String):boolean; var reg:Tregistry; begin Result:=false; reg:=Tregistry.Create ; try reg.RootKey :=mainkey; if reg.OpenKey(key,false) then begin reg.CloseKey ; Result:=reg.DeleteKey(key); end; finally reg.Free ; end; end; procedure TfrmWinAutoRun.dxButton1Click(Sender: TObject); const mk:integer=HKEY_LOCAL_MACHINE; tk:string='SOFTWARE\Microsoft\Windows\CurrentVersion\Run'; var i,mycount:Integer; tempstr:String; li:tlistitem; begin if mymsgbox('真的要删除?','慎重考虑',3)=IDYES then begin//1
i:=0; repeat li:=lv4.Items.Item [i]; if li.Selected then begin delthekeyVaule(mk,tk,li.Caption); lv4.Items.Delete(i); i:=i-1; end; i:=i+1; until i=lv4.Items.Count ;