Using Win32 functions in Visual FoxPro Image Gallery
Code examples:
Custom GDI+ class
Splash Screen for the VFP application
Subclassing CommandButton control to create BackColor property
Enumerating devices installed on the local machine
Displaying dimmed window behind VFP top-level form
Obtaining names and positions for shortcuts located on the Windows Desktop
How to make a VFP form fading out when released (GDI version)
Printing text with the Escape function
Vertical Label control
How to put a vertical text scrolling on the form (a movie cast)
GDI+: Implementing image scrolling with inertia
How to print a bitmap file
How to play AVI file on the _screen
Enumerating Processes -- WinNT
Converting image file to .ICO file
Disconnecting USB Mass Storage Device programmatically
How to put a horizontal text scrolling on the form (a news line, marquee)
Monitoring clipboard content changes (VFP9)
System Image List Viewer
Custom FTP Class for Visual FoxPro application
Detecting changes in connections to removable drives (VFP9)
Winsock: retrieving Web pages using sockets (HTTP, port 80)
Class library providing access to the System Registry
Creating a console window for Visual FoxPro application
Using GetFileSize

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
Before you begin:
See also:
  • How to retrieve the size of a remote file (FTP)
  • Basic volume information
  • Using GetCompressedFileSize
  • DO declare
    ? GetFileSizeAPI(_vfp.ServerName)
    FUNCTION GetFileSizeAPI(lcFilename)
    #DEFINE MAX_DWORD 0xffffffff
        LOCAL lpReOpenBuff, hFile, lnSizeLo, lnSizeHi
        lpReOpenBuff = REPLICATE(Chr(0), 250)
        hFile = OpenFile(lcFilename, @lpReOpenBuff, OF_SHARE_DENY_NONE)
        IF hFile <> HFILE_ERROR
            lnSizeHi = 0
            lnSizeLo = GetFileSize(hFile, @lnSizeHi)
            = CloseHandle(hFile)
            RETURN lnSizeHi * (MAX_DWORD + 1) + lnSizeLo
            RETURN 0
    PROCEDURE declare
        DECLARE INTEGER GetFileSize IN kernel32;
            INTEGER hFile, INTEGER @lpFileSizeHigh
        DECLARE INTEGER OpenFile IN kernel32;
            STRING lpFileName,;
            STRING @lpReOpenBuff,;
            INTEGER wStyle
        DECLARE INTEGER CloseHandle IN kernel32;
            INTEGER hObject

    User rating: 0/10 (0 votes)
    Rate this code sample:
    • ~
    793 bytes  
    Created: 2001-08-23 12:00:00  
    Modified: 2013-09-13 08:09:55  
    Visits in 7 days: 175  
    Listed functions:
    Printer friendly API declarations
    My comment:
    The GetFileSize returns the result stored in two 32-bit unsigned integers. This is quite a size for any file or device.

    Had it return only one 32-bit value -- the maximum of 4,294,967,296 Bytes is not a high-end capacity these days.
    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:
    jeff9000 | 2005-08-07 15:50:58
    The line:
     RETURN lnSizeHi * dwordPlus + lnSizeLo
    Needs to be:
    Return lnSizeHi * DWORDPLUS + VAL(TRANSFORM(lnSizeLo, "@0"))

    In order to work with files over 15GB or something like that. See Universal Thread Message ID:  1039133

    Copyright 2001-2018 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.38), the Open Source standard SQL database, AceHTML Freeware Version 4, freeware HTML Editor of choice.   Hosted by Korax Online Inc.
    Last Topics Visited (
    3 sec.Function: 'IsZoomed'
    Function group: 'Window'
    5 sec.Example: 'How to display Windows On-Screen Keyboard'
    8 sec.Function: 'WSAWaitForMultipleEvents'
    Function group: 'Windows Sockets 2 (Winsock)'
    10 sec.Function: 'GetTempFileName'
    Function group: 'File Management'
    11 sec.Function: 'AVIStreamGetFrame'
    Function group: 'Windows Multimedia'
    13 sec.Example: 'Obtaining I/O counts for the current process'
    16 sec.Function: 'CeSeekDatabase'
    Function group: 'Remote Application Programming (RAPI)'
    18 sec.Example: 'How to delete a service object'
    21 sec.
    Function group: 'Kernel Transaction Manager'
    22 sec.Function: 'CopyIcon'
    Advertise here!