时间: 2021-07-31 作者:daque
亢奋的软硬件喜好者,大多碰到过如许的情景:装过的步调简略或卸载后,有的在“增添/简略步调”中留有残留项,很是不爽!固然不妨用regedit.exe翻开备案表,找到“hkey_local_machine\software\microsoft\windows\currentversion\uninstall”,来简略残留的消息,我不领会你如何样,归正我是感触有点烦,所以我一怒之下,就来个一了百了,遍了底下这个步调来处置这个题目,固然市情上有些软硬件也能处置这个题目,然而它须要我的钞票,所以仍旧本人来吧,其余,用本人的步调处置题目会有很大的功效感:) 步调的界面如次: 固然有点大略,但适用的很(有点王婆卖瓜),步调在win2000 pro sp2下用delphi6.0企业版实行,运转于本机的winme下也没题目,底下贯串原代码与诸位交谈一下,然而别笑我呀! {unit1的代码:} unit unit1; interface uses windows, messages, sysutils, variants, classes, graphics, controls, forms, dialogs,registry, stdctrls, buttons, checklst; //registry为后加上的 type tform1 = class(tform) checklistbox1: tchecklistbox; sfsc: tbitbtn; sc: tbitbtn; bf: tbitbtn; dr: tbitbtn; procedure sfscclick(sender: tobject);//能否简略 procedure scclick(sender: tobject);//简略 procedure bfclick(sender: tobject);//备案表备份 procedure drclick(sender: tobject);//导出备份 procedure formcreate(sender: tobject); private { private declarations } public procedure createparams(var params:tcreateparams);override; { public declarations } end; var form1: tform1; implementation {$r *.dfm} procedure tform1.createparams(var params:tcreateparams); {保护本步调总在窗口最表层,可供你其余步调模仿两个沟通功效的步调碰到一块,谁先运转,谁在底下} var wndparnet:hwnd; begin inherited createparams(params); with params do begin exstyle:=exstyle or ws_ex_topmost or ws_ex_acceptfiles; wndparnet:=getdesktopwindow; end; end; procedure tform1.sfscclick(sender: tobject); // 看看能否简略 var intindex:integer; registrytemp:tregistry; stringtemp:tstrings; runfile:string; begin checklistbox1.clear; registrytemp:=tregistry.create; stringtemp:=tstringlist.create; with registrytemp do begin rootkey:=hkey_local_machine; if openkey('software\microsoft\windows\currentversion\uninstall',false) then getkeynames(stringtemp); closekey; end; for intindex:= 0 to stringtemp.count-1 do checklistbox1.items.add(stringtemp.strings[intindex]); registrytemp.free; stringtemp.free ; runfile:='rundll32.exe shell32.dll,control_rundll appwiz.cpl,,0'; winexec(pchar(runfile),sw_hide); {翻开“遏制面板”的“增添/简略选项”,步调运转到这边,你就领会,我干什么要让我的步调总在视窗的最表层,否则被旁人盖了,多不好玩!} form1.caption:='即使简略不对,请击“导出备份”按钮'; end; procedure tform1.scclick(sender: tobject); //简略 var i:integer; registrytemp:tregistry; strtemp:string; begin for i := 0 to (checklistbox1.items.count-1) do if checklistbox1.checked[i] then begin strtemp:=checklistbox1.items.strings[i]; registrytemp:=tregistry.create; registrytemp.rootkey :=hkey_local_machine; registrytemp.openkey('software\microsoft\windows\currentversion\uninstall',true); registrytemp.deletekey(strtemp); registrytemp.free; end; form1.caption:='请击“能否简略”按钮,查看简略情景'; end; procedure tform1.bfclick(sender: tobject); //备案表备份 var runfile:string; begin deletefile('backup.reg'); runfile:='regedit /e backup.reg hkey_local_machine\software\microsoft\windows\currentversion\uninstall'; winexec(pchar(runfile),sw_hide); form1.caption:='请采用要废除的项,而后击“简略”按钮'; end; procedure tform1.drclick(sender: tobject); //导出备份 var runfile:string; intindex:integer; registrytemp:tregistry; stringtemp:tstrings; begin runfile:='regedit /s backup.reg '; winexec(pchar(runfile),sw_hide); checklistbox1.clear; registrytemp:=tregistry.create; stringtemp:=tstringlist.create; with registrytemp do begin rootkey:=hkey_local_machine; if openkey('software\microsoft\windows\currentversion\uninstall',false) then getkeynames(stringtemp); closekey; end; for intindex:= 0 to stringtemp.count-1 do checklistbox1.items.add(stringtemp.strings[intindex]); registrytemp.free; stringtemp.free ; form1.caption:='已导出备份,请从新采用简略'; end; procedure tform1.formcreate(sender: tobject); var intindex:integer; registrytemp:tregistry; stringtemp:tstrings; begin checklistbox1.clear; registrytemp:=tregistry.create; stringtemp:=tstringlist.create; with registrytemp do begin rootkey:=hkey_local_machine; if openkey('software\microsoft\windows\currentversion\uninstall',false) then getkeynames(stringtemp); closekey; end; for intindex:= 0 to stringtemp.count-1 do checklistbox1.items.add(stringtemp.strings[intindex]); registrytemp.free; stringtemp.free ; form1.caption:='“简略”之前,请先备份'; end; end.