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;