! Name:
Show/Hide Drives
! Description:Show/Hide Drives in Explor
!
er
! By: Kelvin Galván
!
!This code is copyrighted and has ! limited warranties.Please see http://w
!
ww.Planet-Source-Code.com/xq/ASP/txtCode
!
Id.370/lngWId.7/qx/vb/scripts/ShowCode.h
!
tm !for details. !**************************************
//Add Registry to USES
uses
Registry, Windows, Messages, SysUtils,
Classes, Graphics, Controls, Forms, Dialogs,
StdCtrls;
//******************************
procedure TForm1.Button1Click(Sender:
TObject);
var
//Drives
A,B,C,D,E
A, B, C, D, E :
Integer;
fBuffer : Byte;
MyRegistry :
TRegistry;
begin
A:=1;
B:=2;
C:=4;
D:=8;
E:=16;
//Hide Drive A : fBuffer:=A
//Hide Drives A,B,C,D,E :
fBuffer:=A+B+C+D+E
//Show All Drives : fBuffer:=0
fBuffer:=A+C; //Hide Drives A,C
MyRegistry:=TRegistry.Create;
MyRegistry.RootKey:=HKEY_CURRENT_USER;
MyRegistry.OpenKey('SOFTWARE\MICROSOFT\WINDOWS\CURRENTVERSION\POLICIES\EXPLORER',True);
MyRegistry.WriteBinaryData('NoDrives',fBuffer,1);
MyRegistry.CloseKey;
MyRegistry.Free;
//You Need Restart Windows
end;