HOWTO: Change a Drive's Volume Label Programmatically

ID: Q193774


The information in this article applies to:
  • Microsoft Visual FoxPro for Windows, versions 3.0b, 5.0, 5.0a, 6.0


SUMMARY

A drive's volume label can be changed using the Windows API function SetVolumeLabel().


MORE INFORMATION

The following example demonstrates the use of the SetVolumeLabel() API function to change the volume label of a floppy disk.

Sample Code


   DECLARE INTEGER SetVolumeLabel IN Win32API STRING lcRootPath,;
      STRING lcVolumeLabel

   liRetVal = 0
   * Message box with OK/Cancel buttons
   liRetVal = MESSAGEBOX("Insert scratch floppy disk in drive A:",;
      1)

   * Handle non-OK selection from message box
   IF liRetVal # 1
      RETURN
   ENDIF

   lcVolumeLabel = "Test"
   = SetVolumeLabel ("A:\", lcVolumeLabel) 
You can examine the drive label by right-clicking the drive in Explorer and selecting Properties. The volume label is located near the top of the General tab on the Property page.

Additional query words: kbVFp600 kbAPI kbVFp500a kbVFp500 kbVFp300b

Keywords :
Version : WINDOWS:3.0b,5.0,5.0a,6.0
Platform : WINDOWS
Issue type : kbhowto


Last Reviewed: August 10, 1999
© 2000 Microsoft Corporation. All rights reserved. Terms of Use.