uses Registry
//
procedure HideDriver(HideNumber: integer);
var Reg: TRegistry;
begin
Reg := TRegistry.Create;
try
with Reg do
begin
RootKey := HKEY_CURRENT_USER;
OpenKey('Software\Microsoft\Windows\CurrentVersion\Policies\Explorer', True);
WriteInteger('NoDrives', HideNumber);
CloseKey;
RootKey := HKEY_LOCAL_MACHINE;
OpenKey('Software\Microsoft\Windows\CurrentVersion\Policies\Explorer', True);
WriteInteger('NoDrives', HideNumber);
CloseKey;
end;
finally
Reg.Free;
end;
end;
Festplatte Unsichtbar machen :
procedure TForm1.Button1Click(Sender: TObject);
var Reg: TRegistry;
x : Integer;
begin
Reg := TRegistry.Create;
if RadioGroup1.ItemIndex = 0 then x := 4; // C:/
if RadioGroup1.ItemIndex = 1 then x := 8; // D:/
if RadioGroup1.ItemIndex = 2 then x := 16; // E:/
if RadioGroup1.ItemIndex = 3 then x := 32; // F:/
try
with Reg do
begin
RootKey := HKEY_CURRENT_USER;
OpenKey('Software\Microsoft\Windows\CurrentVersion\Policies\Explorer', True);
WriteInteger('NoDrives', x);
CloseKey;
RootKey := HKEY_LOCAL_MACHINE;
OpenKey('Software\Microsoft\Windows\CurrentVersion\Policies\Explorer', True);
WriteInteger('NoDrives', x);
CloseKey;
end;
finally
Reg.Free;
end;
end;
Festplatte wieder Sichtbar machen :
procedure TForm1.Button2Click(Sender: TObject);
var Reg: TRegistry;
begin
Reg := TRegistry.Create;
try
with Reg do
begin
RootKey := HKEY_CURRENT_USER;
OpenKey('Software\Microsoft\Windows\CurrentVersion\Policies\Explorer', True);
DeleteValue('NoDrives');
CloseKey;
RootKey := HKEY_LOCAL_MACHINE;
OpenKey('Software\Microsoft\Windows\CurrentVersion\Policies\Explorer', True);
DeleteValue('NoDrives');
CloseKey;
end;
finally
Reg.Free;
end;
end;
Keine Kommentare:
Kommentar veröffentlichen