Microsoft KB Archive/193774

= How to programmatically change the volume label of a drive from Visual FoxPro =

Article ID: 193774

Article Last Modified on 1/27/2005

-

APPLIES TO


 * Microsoft Visual FoxPro 3.0b Standard Edition
 * Microsoft Visual FoxPro 5.0 Standard Edition
 * Microsoft Visual FoxPro 5.0a
 * Microsoft Visual FoxPro 6.0 Professional Edition
 * Microsoft Visual FoxPro 8.0 Professional Edition
 * Microsoft Visual FoxPro 9.0 Professional Edition
 * Microsoft Visual FoxPro 7.0 Professional Edition

-



This article was previously published under Q193774



SUMMARY
You can change the volume label of a drive programmatically by using the SetVolumeLabel Windows API function.



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 Windows 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: kbhowto kbcode KB193774

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.