Hi again.
Have a problem backing up to removable hard disks with my program as the test
below does not work with HD removable:
function TMainform.IsRemovable: Boolean;
var drvtype: word;
begin
  drvtype := GetDriveType(pchar(ExtractFileDrive(VCLzip1.ZipName)));
  if (drvtype = DRIVE_REMOVABLE) or (drvtype = DRIVE_CDROM) then
    Result := true else Result := false;
end;

I figure my new code below might be suitable. General opinion on safety of
forcing the labeling (is there likely to be issue with Win95) please?
:

function TMainform.IsRemovable: Boolean;
const test = '###### TEST'; { MUST BE UPPER CASE }
var tmp, drv: string;
  drvtype: word;
begin
  result := false;
  drv := ExtractFileDrive(VCLzip1.ZipName);
  drvtype := GetDriveType(pChar(drv));
  tmp := GetVolumeName(drv);
  if SetVolumelabel(pchar(drv), test) then //if can write label is removable
  begin
    result := true;
    SetVolumelabel(pchar(drv), pchar(tmp));
  end;
end;

---------------------------------------------------------------------------
    New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
                  Website: http://www.delphi.org.nz
To UnSub, send email to: [EMAIL PROTECTED] 
with body of "unsubscribe delphi"
Web Archive at: http://www.mail-archive.com/delphi%40delphi.org.nz/

Reply via email to