procedure TForm1.RzBitBtn1Click(Sender: TObject);
var
Registry:TRegistry;
begin
Registry:=TRegistry.Create;//创建TRegistry类的变量
Registry.RootKey:=HKEY_CURRENT_USER;//打开注册表中根键
if Registry.OpenKey('Software\Microsoft\Windows\CurrentVersion\Policies\Explorer',True) then
//A驱为1,B驱为2,C驱为4,D驱为8,以后类推,得出的数字换成16进制,低位在前,高位在后。
//如隐藏A、B、C三个盘为 07 00 00 00,如为隐藏的所有驱动器 FF FF FF FF
Registry.WriteInteger('NoviewOnDrive',$4);
Registry.WriteInteger('NoDrives',$4);
SendMessage(HWND_BROADCAST,WM_SETTINGCHANGE,0,0);
end;