怎样删除主健?(30分)

  • 主题发起人 主题发起人 thebluehouse2
  • 开始时间 开始时间
T

thebluehouse2

Unregistered / Unconfirmed
GUEST, unregistred user!
怎样删除:HKEY_LOCAL_MACHINE/sorftware/microsorft/windows中的sorftware?
 
有引用单元加入Registry
//////////////
Var
Reg:TRegistry;
begin
Reg:=TRegistry.Create;
Reg.RootKey:=HKEY_LOCAL_MACHINE;
Reg.OpenKey('SOFTWARE/Microsoft/Windows',True);
Reg.DeleteKey('sorftware');
Reg.Destroy;
end;
///////////
创建:aregistry:=Tregistry.create
释放:aregistry.destory;
指定根键:例如:rootkey:=hkey_class_root;
指定要操作的主键:openkey
关闭当前主键:closekey
read方法:readinteger,readstring等
write方法:writestring,writeinteger等
键值维护:
创建主键createkey;
删除主键deletekey;
复制移动制件movekey;
判断主键是否存在keyexist;
判断数值名称是否存在valueexists;
数值名改名renamevalue

 
thebluehouse2:

你想搞破坏呀???在注册表中,有些键或值是被操作系统保护了的,权限不够是删除不了的,

 
只想举一反三,举个例子!反正不管谁回答,通过就给分,方法不一样平分一半,我理解就放分!
 
照QuickSilver兄台源码如下,没删掉主健(项),编译测试没通过!


unit Unit1;

interface

uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls,Registry;

type
TForm1 = class(TForm)
Button1: TButton;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;

var
Form1: TForm1;

implementation

{$R *.dfm}

procedure TForm1.Button1Click(Sender: TObject);
Var
Reg:TRegistry;
begin
Reg:=TRegistry.Create;
Reg.RootKey:=HKEY_LOCAL_MACHINE;
Reg.OpenKey('SOFTWARE/thebluehouse/pro/',false);
Reg.DeleteKey('thebluehouse');
Reg.Destroy;
end;


end.
 
兄弟:把 TForm1.Button1Click中内容改为:

Reg:=TRegistry.Create;
Reg.RootKey:=HKEY_LOCAL_MACHINE;
Reg.OpenKey('SOFTWARE/',True);
Reg.DeleteKey('thebluehouse');
Reg.Destroy;
 
言之有理!
 

Similar threads

回复
0
查看
990
不得闲
S
回复
0
查看
796
SUNSTONE的Delphi笔记
S
S
回复
0
查看
760
SUNSTONE的Delphi笔记
S
S
回复
0
查看
829
SUNSTONE的Delphi笔记
S
后退
顶部