嫩
嫩手
Unregistered / Unconfirmed
GUEST, unregistred user!
我想问一下,下面的写法哪个比较好?
procedure do
ntReboot(XP_Reboot:Boolean);stdcall;
var
reg :tregistry;
begin
Reg := TRegistry.Create;
try
Reg.RootKey := HKEY_LOCAL_MACHINE;
Reg.OpenKey('System/CurrentControlSet/Control/CrashControl',true);
if XP_Reboot then
Reg.WriteInteger('AutoReboot',0)
else
Reg.WriteInteger('AutoReboot',1)
finally
Reg.CloseKey;
Reg.Free;
end;
end;
function do
ntReboot(XP_Reboot:Boolean): boolean;stdcall;
var reg:TRegistry;
begin
result:=true;
reg:=TRegistry.Create;
Reg.RootKey := HKEY_LOCAL_MACHINE;
TRY
Reg.OpenKey('System/CurrentControlSet/Control/CrashControl',true);
if xp_reBoot then
//自动启动
Reg.WriteInteger('AutoReboot',0)
else
Reg.WriteInteger('AutoReboot',1)
except
result:=false;
end;
reg.CloseKey;
reg.Free;
end;
procedure do
ntReboot(XP_Reboot:Boolean);stdcall;
var
reg :tregistry;
begin
Reg := TRegistry.Create;
try
Reg.RootKey := HKEY_LOCAL_MACHINE;
Reg.OpenKey('System/CurrentControlSet/Control/CrashControl',true);
if XP_Reboot then
Reg.WriteInteger('AutoReboot',0)
else
Reg.WriteInteger('AutoReboot',1)
finally
Reg.CloseKey;
Reg.Free;
end;
end;
function do
ntReboot(XP_Reboot:Boolean): boolean;stdcall;
var reg:TRegistry;
begin
result:=true;
reg:=TRegistry.Create;
Reg.RootKey := HKEY_LOCAL_MACHINE;
TRY
Reg.OpenKey('System/CurrentControlSet/Control/CrashControl',true);
if xp_reBoot then
//自动启动
Reg.WriteInteger('AutoReboot',0)
else
Reg.WriteInteger('AutoReboot',1)
except
result:=false;
end;
reg.CloseKey;
reg.Free;
end;