procedure TForm1.Button1Click(Sender: TObject);
var Reg: TRegistry;
begin
Reg := TRegistry.Create;
try
with Reg do
begin
RootKey := HKEY_LOCAL_MACHINE;
OpenKey
('Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\DriveIcons\\', True);
{ Benar, Karena jika subkey bernama driveicon dan/atau defaulticon Tidak ada, Windows secara otomatis menciptakan ini }
OpenKey('C\\DefaultIcon\\', True); // as default first drive C
// Kami sedang memilih field kosong sebagai nilai anggapan
WriteString('', 'C:\\YourIcons\\Sample1.ico');
{ and icon file path or if dll file then
e.g 'c:\\YourIcons\\Icons.dll, 2' }
CloseKey;
end;
finally
Reg.Free;
end;
Selamat mencoba.