Declare Function SetVolumeLabel Lib "kernel32.dll" Alias "SetVolumeLabelA" (ByVal lpRootPathName As String, ByVal lpVolumeName As String) As Long
SetVolumeLabel sets the label of a file system volume. The new volume label must comply with length constaints and cannot contain any invalid characters.
If an error occured, the function returns 0 (use GetLastError to get the error code). If successful, the function returns a non-zero value.
None.
' This code is licensed according to the terms and conditions listed here.
' Declarations and such needed for the example:
' (Copy these to the (declarations) section of a module.)
Public Declare Function SetVolumeLabel Lib "kernel32.dll" Alias "SetVolumeLabelA" _
(ByVal lpRootPathName As String, ByVal lpVolumeName As String) As Long
' Set the file system volume label of the C: drive to "MYDRIVE".
Dim retval As Long ' return value
' Set the new volume label.
retval = SetVolumeLabel("C:\", "MYDRIVE")
Back to the Function list.
Back to the Reference section.
Last Modified: April 16, 2000
This page is copyright © 2000 Paul Kuliniewicz.
Copyright Information Revised October 29, 2000
Go back to the Windows API Guide home page.
E-mail: vbapi@vbapi.com Send Encrypted E-Mail
This page is at http://www.vbapi.com/ref/s/setvolumelabel.html