- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
- 27
- 28
- 29
- 30
- 31
- 32
- 33
- 34
- 35
- 36
- 37
- 38
- 39
- 40
- 41
- 42
- 43
- 44
- 45
procedure TToolFrm.RemIconBtnClick(Sender: TObject);
function GetSelectedDrive:string;
var
S:string;
begin
Result:='';
S:=DrView.Drive;
if S <> '' then
Result:=S+':\';
end;
var
path:string;
ID:Integer;
VolumeName:string;
VolumeNameSize,
VolumeSerial,
MaxComponentsLen,
FileSystemFlags:DWORD;
begin
Path:=GetSelectedDrive;
if Path='' then
begin
MessageBox(handle,PChar('Выберите диск в списке дисков'), PChar(''), 48);
Exit;
end;
Path:=IncludeTrailingPathDelimiter(Path);
SetLength(VolumeName,200);
VolumeNameSize:=200;
if not GetVolumeInformation(PChar(Path),PChar(VolumeName),VolumeNameSize,@VolumeSerial,MaxComponentsLen,FileSystemFlags,nil,0) then
begin
MessageBox(handle,PChar(Format('Диск %s недоступен или повреждён.',[Path])), PChar(''), 48);
Exit;
end;
if (not DeleteFile(PChar(Path+'#Icon#'))) or (not DeleteFile(PChar(Path+'Autorun.inf'))) then
Messagebox(Handle, PChar('Значок не найден'), PChar(''), 0)
else
begin
SetVolumeLabel(PChar(Path),nil);
SetVolumeLabel(PChar(Path), PChar(VolumeName));
Messagebox(Handle, PChar('Значок удален'), PChar(''), 0)
end;
end;
Даже обидно немного... Чего это Вы все умные такие? Ничем вас не удивишь...