Hello Nicholas,
>> 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?
NS> You can set the volume label of non-removable drives just fine with this
NS> code too, can't you?
That is what I suspected, WinXP you cant, but I am fairly sure it will in Win95
- I will have to dust off the old computer and test it to confirm. If so,
obviously the test given is unsuitable.
--
Regards,
Alistair+
I tidied up the code a little more:
function TMainform.IsRemovable(Ffile:string): Boolean;
const test = '###### TEST'; { MUST BE UPPER CASE }
var tmp, drv: string;
var drvtype: word;
begin
result := false;
drv := ExtractFileDrive(Ffile);
drvtype := GetDriveType(pchar(drv));
if (drvtype = DRIVE_REMOVABLE) or (drvtype = DRIVE_CDROM) then
begin
Result := true;
exit;
end;
tmp := GetVolumeName(drv);
if SetVolumelabel(pchar(drv), test) then
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/