KnowledgeBase Archive

An Archive of Early Microsoft KnowledgeBase Articles

View on GitHub

Q193774: HOWTO: Change a Drive’s Volume Label Programmatically

Article: Q193774
Product(s): Microsoft FoxPro
Version(s): WINDOWS:3.0b,5.0,5.0a,6.0
Operating System(s): 
Keyword(s): 
Last Modified: 11-AUG-1999

-------------------------------------------------------------------------------
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          :  
Technology        : kbVFPsearch kbAudDeveloper kbVFP300b kbVFP500 kbVFP600 kbVFP500a
Version           : WINDOWS:3.0b,5.0,5.0a,6.0
Issue type        : kbhowto

=============================================================================

THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Copyright Microsoft Corporation 1986-2002.