已经有了下述代码,请把终止的代码写出来
注意窗口里面有一个ListView1=========================================================================
var
reg : TRegistry;
subreg: TStrings;
t : TListItem;
begin
subreg := TStringList.Create;
Reg := TRegistry.Create;
Reg.RootKey := HKEY_CURRENT_USER;
if Reg.OpenKey('\Software\Microsoft\Windows\CurrentVersion\Run',False)
then begin
Reg.GetValueNames(subreg);
for i:=0 to subreg.Count-1 do
begin
t := ListView1.Items.Add;
t.Caption := Reg.ReadString(subreg.Strings[i]);
t.SubItems.Add('注册表->HKEY_CURRENT_USER->Run');
end;
end; if Reg.OpenKey('\Software\Microsoft\Windows\CurrentVersion\RunServices',False)
then begin
Reg.GetValueNames(subreg);
for i:=0 to subreg.Count-1 do
begin
t := ListView2.Items.Add;
t.Caption := Reg.ReadString(subreg.Strings[i]);
t.SubItems.Add('注册表->HKEY_CURRENT_USER->RunServices');
end;
end; Reg.RootKey := HKEY_LOCAL_MACHINE;
if Reg.OpenKey('\Software\Microsoft\Windows\CurrentVersion\Run',False)
then begin
Reg.GetValueNames(subreg);
for i:=0 to subreg.Count-1 do
begin
t := ListView1.Items.Add;
t.Caption := Reg.ReadString(subreg.Strings[i]);
t.SubItems.Add('注册表->HKEY_LOCAL_MACHINE->Run');
end;
end; if Reg.OpenKey('\Software\Microsoft\Windows\CurrentVersion\RunServices',False)
then begin
Reg.GetValueNames(subreg);
for i:=0 to subreg.Count-1 do
begin
t := ListView1.Items.Add;
t.Caption := Reg.ReadString(subreg.Strings[i]);
t.SubItems.Add('注册表->HKEY_LOCAL_MACHINE->RunServices');
end;
end;
end;
注意窗口里面有一个ListView1=========================================================================
var
reg : TRegistry;
subreg: TStrings;
t : TListItem;
begin
subreg := TStringList.Create;
Reg := TRegistry.Create;
Reg.RootKey := HKEY_CURRENT_USER;
if Reg.OpenKey('\Software\Microsoft\Windows\CurrentVersion\Run',False)
then begin
Reg.GetValueNames(subreg);
for i:=0 to subreg.Count-1 do
begin
t := ListView1.Items.Add;
t.Caption := Reg.ReadString(subreg.Strings[i]);
t.SubItems.Add('注册表->HKEY_CURRENT_USER->Run');
end;
end; if Reg.OpenKey('\Software\Microsoft\Windows\CurrentVersion\RunServices',False)
then begin
Reg.GetValueNames(subreg);
for i:=0 to subreg.Count-1 do
begin
t := ListView2.Items.Add;
t.Caption := Reg.ReadString(subreg.Strings[i]);
t.SubItems.Add('注册表->HKEY_CURRENT_USER->RunServices');
end;
end; Reg.RootKey := HKEY_LOCAL_MACHINE;
if Reg.OpenKey('\Software\Microsoft\Windows\CurrentVersion\Run',False)
then begin
Reg.GetValueNames(subreg);
for i:=0 to subreg.Count-1 do
begin
t := ListView1.Items.Add;
t.Caption := Reg.ReadString(subreg.Strings[i]);
t.SubItems.Add('注册表->HKEY_LOCAL_MACHINE->Run');
end;
end; if Reg.OpenKey('\Software\Microsoft\Windows\CurrentVersion\RunServices',False)
then begin
Reg.GetValueNames(subreg);
for i:=0 to subreg.Count-1 do
begin
t := ListView1.Items.Add;
t.Caption := Reg.ReadString(subreg.Strings[i]);
t.SubItems.Add('注册表->HKEY_LOCAL_MACHINE->RunServices');
end;
end;
end;
解决方案 »
- 如何表示任意文件夹呢,文件可以用*.*表示,那任意文件夹要怎么表示,或者可以告诉我怎样的到某一路径下的文件夹里的文件
- 在RichEdit控件中使用ctrl+enter快捷键的问题
- richview能否作出这样的效果?
- 请教!winsock连接服务器时阻塞问题。
- 穷我们所能未能解决的问题,请问大虾们。
- 请问DELPHI和BCB如何协同工作比较好?
- dbgrid显示不了varchar字段里的内容,为什么?
- 怎样得到系统时间,谢谢
- 为什么我执行到query.open时出错!100分
- 竖排报表,分页打印,知道者帮帮忙 ! 急急急急……
- delphi+sqlseerver 用什么数据库组件整体最好!来着给分,(50)
- 急需D5企业版下载地址~!
用PostMessage(FindWindow(nil,Caption),WM_QUIT,0,0)//WM_QUIT也可用WM_CLOSE
下面这些代码和上面是出于同一个程序的,请参考。====================================================================procedure TFrmMain.Button1Click(Sender: TObject);
var
reg : TRegistry;
t : TListItem;
begin
if ListView1.SelCount<1 then exit;
Reg := TRegistry.Create; try
t := ListView1.Selected;
if t.SubItems.Strings[1]='注册表->HKEY_CURRENT_USER->Run'then
begin
Reg.RootKey := HKEY_CURRENT_USER;
Reg.OpenKey('\Software\Microsoft\Windows\CurrentVersion\Run',False);
Reg.DeleteValue(t.Caption);
end; if t.SubItems.Strings[1]='注册表->HKEY_CURRENT_USER->RunServices' then
begin
Reg.RootKey := HKEY_CURRENT_USER;
Reg.OpenKey('\Software\Microsoft\Windows\CurrentVersion\RunServices',False);
Reg.DeleteValue(t.Caption);
end; if t.SubItems.Strings[1]='注册表->HKEY_LOCAL_MACHINE->Run' then
begin
Reg.RootKey := HKEY_LOCAL_MACHINE;
Reg.OpenKey('\Software\Microsoft\Windows\CurrentVersion\Run',False);
Reg.DeleteValue(t.Caption);
end; if t.SubItems.Strings[1]='注册表->HKEY_LOCAL_MACHINE->RunServices' then
begin
Reg.RootKey := HKEY_LOCAL_MACHINE;
Reg.OpenKey('\Software\Microsoft\Windows\CurrentVersion\RunServices',False);
Reg.DeleteValue(t.Caption);
end; t.Delete;
except
exit;
end;
Reg.Free;
end;