From: "Chris Antos (Exchange)"
there is a Win32 API, "SetVolumeLabel". here is how to use it from TSE:
dll ""
integer proc SetVolumeLabel(
string RootPathName:cstrval,
string VolumeName:cstrval) : "SetVolumeLabelA"
integer proc DeleteVolumeLabel(
string RootPathName:cstrval,
integer MustBeZero) : "SetVolumeLabelA"
// yes, "SetVolumeLabelA" is correct for both the functions, it is not a
typo.
end
example:
proc Foo()
SetVolumeLabel("C:\", "DRIVE_C")
end
here is the documentation from the Win32 Programmer's Reference (edited
slightly by me):
-----
The SetVolumeLabel function sets the label of a file system volume.
integer proc SetVolumeLabel(
string RootPathName, // address of name of root directory for
volume
string VolumeName // name for the volume
);
Parameters
RootPathName:
Points to a string specifying the root directory of a file
system volume. This is the volume the function will label.
VolumeName:
Points to a string specifying a name for the volume. [To delete
the label from a volume, call DeleteVolumeLabel(RootPathName, 0)].
Return Value:
If the function succeeds, the return value is TRUE.
If the function fails, the return value is FALSE. To get
extended error information, call GetLastError.
-----
//chris
> -----Original Message-----
> From: Sammy Mitchell [SMTP:sammy.mitchell@semware.com]
> Sent: Friday, January 02, 1998 8:57 AM
> To: tsepro@semware.com
> Subject: How to Set the Volume Label?
>
> the
> original author>
>
> Happy New Year everyone!
>
> Here's a TSE 2.8 question...
>
> I've been working on a customised File Manager macro and want to Get
> and Set a drive's Volume label.
>
> Initially, I thought FindFirstFile()/FindNextFile() using attributes
> of
> _VOLUME_ would give me the Volume label but that didn't work.
>
> Luckily, I found an undocumented function in TSE called
> GetVolumeInfo()
> which does the trick.
>
> It works like this:
>
> integer GetVolumeInfo( STRING drive, VAR STRING volume)
>
> NB: drive must be the rootpath ie. have a trailing slash.
> eg.
>
> string volume[20] = ""
>
> GetVolumeInfo( "c:\" , volume)
> warn("Volume label of Drive C is", volume)
>
>
> However, I can find no way to Set or Update the Volume label without
> resorting to an lDos("label","C:MYVOL",_DONTCLEAR_|_DONT_PROMPT_).
>
> Does anyone know a DLL call I can use to set the Volume Label?
>
> Thanks in advance,
>
> Ross Boyd
>
>
>
>
>
---
---------------
* Origin: apana>>>>>fidonet [sawasdi.apana.org.au] (3:800/846.13)
|