Using Win32 functions in Visual FoxPro Image Gallery
Code examples:
Using the DeleteFile
Using the GradientFill function
Winsock: retrieving the host information corresponding to a network address
Creating a directory on the FTP
Enumerating servers of the specified type (e.g. SQL Server) in the primary domain
Finding out if the current user is the Guest account
GDI+: converting image file to another graphics format
GDI+: custom Slider control
How to position the GETPRINTER() dialog
How to remove FTP directory
How to Start a Process as Another User (NT/XP/2K)
How to view icons stored in executable files (Icon Viewer) - II
Quering a waveform-audio input device
Quering waveform-audio output devices
Retrieving IP statistics for the computer
Retrieving list of available disk drives
Retrieving long values associated with the class of the VFP window
Using GetSysColor
Converting long file names to the short format and vice versa
Displaying the drive type value
How to block the ALT+TAB shortcut (WinXP)
How to browse and connect to printers on a network (WinNT)
How to obtain the number of rows affected by remote UPDATE, INSERT or DELETE statement
Loading a string resource from an executable file
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
Versions:
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 FILE_CASE_SENSITIVE_SEARCH 1
    #DEFINE FILE_CASE_PRESERVED_NAMES 2
    #DEFINE FILE_UNICODE_ON_DISK 4
    #DEFINE FILE_PERSISTENT_ACLS 8
    #DEFINE FILE_FILE_COMPRESSION 16
    #DEFINE FILE_VOLUME_IS_COMPRESSED 0x8000
    #DEFINE MAX_PATH 260
    #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
    
        STORE REPLICATE(CHR(0),MAX_PATH) TO;
            cVolNameBuffer, nFilesysNameBuffer
    
        STORE 0 TO nVolSerialNo, nMaxCompLen, nFlags
    
        nResult = GetVolumeInformation(cRoot, @cVolNameBuffer,;
            MAX_PATH, @nVolSerialNo, @nMaxCompLen, @nFlags,;
            @nFilesysNameBuffer, MAX_PATH)
    
        IF nResult = 0
        * 3=ERROR_PATH_NOT_FOUND
        * 21=ERROR_NOT_READY
        * 87=ERROR_INVALID_PARAMETER
            nError = GetLastError()
            = MESSAGEBOX("GetVolumeInformation() call failed: " +;
                TRANSFORM(m.nError), 48, m.cRoot)
            RETURN
        ENDIF
    
        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
            BROWSE NORMAL NOWAIT
        ENDIF
    
    PROCEDURE LogInfo(cName, vValue)
        IF NOT USED("csResult")
            CREATE CURSOR csResult (property_name C(50), property_value C(50))
        ENDIF
    
        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: 18  
    Listed functions:
    GetLastError
    GetVolumeInformation
    Printer friendly API declarations
    Word Index links for this example:
    Translate this page:
      Spanish    Portuguese    German    French    Italian  
    FreeTranslation.com offers instant, free translations of text or web pages.
    User Contributed Notes:
    There are no notes on this subject.


    Copyright 2001-2014 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.1.68), the Open Source standard SQL database, AceHTML Freeware Version 4, freeware HTML Editor of choice.   Hosted by Korax Online Inc.
    Last Topics Visited (54.237.235.12)
    25 sec.Example: 'Creating a file, then moving it to another destination'
    1.98 min.Example: 'Terminating all running applications from a VFP program'
    1.53 hrs.Example: 'How to copy the image of a form to the Clipboard using Bitmap API functions'
    1.56 hrs.Function: 'AVIStreamLength'
    Function group: 'Windows Multimedia'
    Google
    Advertise here!