Using Win32 functions in Visual FoxPro Image Gallery
Code examples:
Using the CreateFile
Converting long file names to the short format and vice versa
Enumerating the subkeys of a user-specific key
Obtaining I/O counts for the current process
Reading and setting Environment variables
Reading the state of mouse buttons within DO WHILE loop
Retrieving Window Class information for the VFP window
Saving available locale records into a cursor
Winsock: how to retrieve a service information corresponding to a port
Basic Volume information
How to delete file on FTP server
Disk in drive A:
FindText -- the hopeless and useless Common Dialog
How to make the caption of a VFP application flashing in the Windows task bar
Reading VFP settings from the Windows Registry
URL: splitting into its component parts
Connecting a local device to a network resource
How to retrieve configuration data for a specified printer stored in the registry (PrinterDriverData key)
Opening the Page Setup dialog box to specify the attributes of a printed page
Retrieving information specific to the current Time Zone
Scanning a hierarchy of child windows down from the Windows Desktop
The original LoadPicture() function in VFP returns valid handles to bitmaps, icons, cursors, and metafiles
Converting an HTTP time/date string to a SYSTEMTIME structure
Displaying standard progress dialog box when copying files
Basic Volume information

User rating: 0/10 (0 votes)
Rate this code sample:
  • ~
More code examples    Listed functions    Add comment     W32 Constants      Translate this page Printer friendly version of this code sample
click to open
Before you begin:

See also:
  • Displaying the drive type value
  • Setting the volume label
  • Disk in drive A:
  • Obtaining physical parameters for a drive: sectors, clusters, cylinders...
    #DEFINE CRLF CHR(13)+CHR(10)
        DO declare
        DO GetVolumeInfo WITH "C:\"
    * end of main
    PROCEDURE GetVolumeInfo(cRoot As String)
        LOCAL cVolNameBuffer, nVolSerialNo, nMaxCompLen, nFlags, nError
            cVolNameBuffer, nFilesysNameBuffer
        STORE 0 TO nVolSerialNo, nMaxCompLen, nFlags
        nResult = GetVolumeInformation(cRoot, @cVolNameBuffer,;
            MAX_PATH, @nVolSerialNo, @nMaxCompLen, @nFlags,;
            @nFilesysNameBuffer, MAX_PATH)
        IF nResult = 0
        * 21=ERROR_NOT_READY
            nError = GetLastError()
            = MESSAGEBOX("GetVolumeInformation() call failed: " +;
                TRANSFORM(m.nError), 48, m.cRoot)
        DO LogInfo WITH "Root", m.cRoot
        DO LogInfo WITH "File System Name",;
            LEFT(nFilesysNameBuffer, AT(CHR(0),nFilesysNameBuffer)-1)
        DO LogInfo WITH "Volume Name",;
            LEFT(cVolNameBuffer, AT(CHR(0),cVolNameBuffer)-1)
        DO LogInfo WITH "Volume Serial No.",;
            TRANSFORM(nVolSerialNo, "@0")
        DO LogInfo WITH "Max Filename Length", nMaxCompLen
        DO LogInfo WITH "File System Flags", TRANSFORM(nFlags, "@0")
        DO LogInfo WITH "Case-sensitive file names support",;
            IIF(BITAND(nFlags, FILE_CASE_SENSITIVE_SEARCH)=0, "No", "Yes")
        DO LogInfo WITH "The file system preserves the case of file names",;
            IIF(BITAND(nFlags, FILE_CASE_PRESERVED_NAMES)=0, "No", "Yes")
        DO LogInfo WITH "Unicode in file names support",;
            IIF(BITAND(nFlags, FILE_UNICODE_ON_DISK)=0, "No", "Yes")
        DO LogInfo WITH "ACLs support",;
            IIF(BITAND(nFlags, FILE_PERSISTENT_ACLS)=0, "No", "Yes")
        DO LogInfo WITH "File-based compression support",;
            IIF(BITAND(nFlags, FILE_FILE_COMPRESSION)=0, "No", "Yes")
        DO LogInfo WITH "The specified volume is a compressed volume",;
            IIF(BITAND(nFlags, FILE_VOLUME_IS_COMPRESSED)=0, "No", "Yes")
        IF USED("csResult")
            SELECT csResult
            GO TOP
    PROCEDURE LogInfo(cName, vValue)
        IF NOT USED("csResult")
            CREATE CURSOR csResult (property_name C(50), property_value C(50))
        INSERT INTO csResult (property_name, property_value);
        VALUES (m.cName, TRANSFORM(m.vValue))
    PROCEDURE declare
        DECLARE INTEGER GetLastError IN kernel32
        DECLARE SHORT GetVolumeInformation IN kernel32;
            STRING lpRootPathName, STRING @lpVolumeNameBuffer,;
            LONG nVolumeNameSize, LONG @lpVolumeSerialNumber,;
            LONG @lpMaximumComponentLength, LONG @lpFlags,;
            STRING @lpFileSystemNameBuffer, LONG nFilesysNameSize

    User rating: 0/10 (0 votes)
    Rate this code sample:
    • ~
    2754 bytes  
    Created: 2001-08-10 12:00:00  
    Modified: 2009-02-16 14:55:10  
    Visits in 7 days: 76  
    Listed functions:
    Printer friendly API declarations
    Word Index links for this example:
    Translate this page:
      Spanish    Portuguese    German    French    Italian offers instant, free translations of text or web pages.
    User Contributed Notes:
    There are no notes on this subject.

    Copyright 2001-2017 News2News, Inc. Before reproducing or distributing any data from this site please ask for an approval from its owner. Unless otherwise specified, this page is for your personal and non-commercial use. The information on this page is presented AS IS, meaning that you may use it at your own risk. Microsoft Visual FoxPro and Windows are trade marks of Microsoft Corp. All other trademarks are the property of their respective owners. 

    Privacy policy
    Credits: PHP (4.4.9), an HTML-embedded scripting language, MySQL (5.6.37), the Open Source standard SQL database, AceHTML Freeware Version 4, freeware HTML Editor of choice.   Hosted by Korax Online Inc.
    Last Topics Visited (
    12 sec.Function: 'CreateWindowEx'
    24 sec.Function: 'NetScheduleJobDel'
    Function group: 'Network Management'
    36 sec.Function: 'CreateFont'
    49 sec.Example: 'How to perform Base64 encoding/decoding using Cryptography API Functions'
    1.03 min.Example: 'Using WM_COPYDATA for interprocess communication (VFP9)'
    1.25 min.Solution: 'ContextMenu ActiveX Control'
    1.47 min.Function: 'CryptDestroyKey'
    Function group: 'Cryptography Reference'
    1.72 min.Example: 'Running MSDOS Shell as a child process with redirected input and output (smarter RUN command)'
    1.93 min.Function: 'closesocket'
    Function group: 'Windows Sockets 2 (Winsock)'
    2.18 min.Example: 'Testing serial ports'
    Advertise here!