Kernel32SetVolumeLabel Method
Sets the label of a file system volume.
Namespace: DevCase.Win32.NativeMethodsAssembly: DevCase.net48 (in DevCase.net48.dll) Version: 6.0.0.0 (6.0)
XMLNS for XAML: Not mapped to an xmlns.
[DllImportAttribute("Kernel32.dll", CharSet = CharSet.Auto, BestFitMapping = false,
ThrowOnUnmappableChar = true, SetLastError = true)]
public static bool SetVolumeLabel(
string rootPathName,
string volumeName
)
<DllImportAttribute("Kernel32.dll", CharSet := CharSet.Auto, BestFitMapping := false,
ThrowOnUnmappableChar := true, SetLastError := true>]
Public Shared Function SetVolumeLabel (
rootPathName As String,
volumeName As String
) As Boolean
Dim rootPathName As String
Dim volumeName As String
Dim returnValue As Boolean
returnValue = Kernel32.SetVolumeLabel(rootPathName,
volumeName)
public:
[DllImportAttribute(L"Kernel32.dll", CharSet = CharSet::Auto, BestFitMapping = false,
ThrowOnUnmappableChar = true, SetLastError = true)]
static bool SetVolumeLabel(
String^ rootPathName,
String^ volumeName
)
[<DllImportAttribute("Kernel32.dll", CharSet = CharSet.Auto, BestFitMapping = false,
ThrowOnUnmappableChar = true, SetLastError = true)>]
static member SetVolumeLabel :
rootPathName : string *
volumeName : string -> bool
No code example is currently available or this language may not be supported.
- rootPathName String
-
A pointer to a string that contains the volume's drive letter (for example, X:)
or the path of a mounted folder that is associated with the volume (for example, Y:\MountX).
The string must end with a trailing backslash ('').
If this parameter is , the root of the current directory is used.
- volumeName String
-
A pointer to a string that contains the new label for the volume.
If this parameter is ,
the function deletes any existing label from the specified volume and does not assign a new label.
Boolean
If the function succeeds, the return value is
.
If the function fails, the return value is
.
To get extended error information, call
GetLastWin32Error.