Using Win32 functions in Visual FoxPro Image Gallery
Code examples:
Drawing standard Windows icons
Enumerating ports that are available for printing on a specified server
Reading the state of mouse buttons within DO WHILE loop
Reading VFP settings from the Windows Registry
Retrieving information about MS-DOS device names using QueryDosDevice (WinNT only)
Retrieving the name of the primary domain controller (PDC) and join status information (NT/2000/XP)
The DetectAutoProxyUrl function identifies the auto-config script location
Using the GetTempFileName
DiskFreeSpace class
Enumerating MIDI output devices
GDI+: Storing DLL icon resources in image files
How to view system icons for the classes installed on the local machine
Obtaining names of local and global groups for current user (WinNT/XP/2K)
Obtaining physical parameters for a drive: sectors, clusters, cylinders...
Deleting a file stored on the FTP server
Get the power status of your laptop computer
Returning some basic information for the specified INF file
Current keyboard type
Obtaining heap handles and enumerating memory blocks for the current VFP session (WinNT only)
Obtaining I/O counts for the current process
Obtaining OS memory performance information
Removing FTP directory
Retrieveing information about the active window (even if it is not owned by the calling process)
Testing MS Internet Explorer version installed
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
 
PARAMETERS  lcFilename
 
#DEFINE OF_READ                0
#DEFINE OF_SHARE_DENY_NONE    64
#DEFINE HFILE_ERROR           -1
#DEFINE dwordPlus 0xffffffff + 1
 
LOCAL lpReOpenBuff, hFile, lnSizeLo, lnSizeHi
 
lpReOpenBuff = REPLI (Chr(0), 250)
hFile = OpenFile (lcFilename, @lpReOpenBuff, OF_SHARE_DENY_NONE)
 
IF hFile <> HFILE_ERROR
    lnSizeHi = 0
    lnSizeLo = GetFileSize (hFile, @lnSizeHi)
    RETURN lnSizeHi * dwordPlus + lnSizeLo
    = CloseHandle (hFile)
ELSE
    RETURN 0
ENDIF
 
PROCEDURE  decl
    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:
  • ~
776 bytes  
Created: 2001-08-23 12:00:00  
Modified: 2005-12-27 10:31:24  
Visits in 7 days: 85  
Listed functions:
CloseHandle
GetFileSize
OpenFile
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  
FreeTranslation.com 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-2013 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.55-log), the Open Source standard SQL database, AceHTML Freeware Version 4, freeware HTML Editor of choice.   Hosted by Korax Online Inc.
Last Topics Visited (50.16.108.167)
3 sec.Function: 'SetWindowPos'
Function group: 'Window'
19.85 min.Example: 'Printing Image File, programmatically set print page orientation to landscape'
19.92 min.
Function group: 'Extensible Storage Engine (ESE, Jet Blue)'
19.97 min.Example: 'How to position the GETPRINTER() dialog'
27.25 min.Example: 'Retrieving file information for the VFP executable running'
27.33 min.Example: 'Scanning a hierarchy of child windows down from the Windows Desktop'
1.02 hrs.Example: 'How to run FoxPro application under different user name (impersonating user)'
1.67 hrs.Function: 'DestroyMenu'
 Function: 'ToAscii'
 Example: 'Simulating DOEVENTS'
Google
Advertise here!