Using Win32 functions in Visual FoxPro Image Gallery
Code examples:
How to change display settings: screen resolution, screen refresh rate
Adding and deleting Scheduled Tasks using NetScheduleJob API functions
Custom GDI+ class
Converting Unicode data from the Clipboard to a character string using a given code page
Capturing keyboard activity of another application with the Raw Input API (VFP9)
Enumerating data formats currently available on the clipboard
Winsock: sending email messages (SMTP, port 25)
Custom FTP Class for Visual FoxPro application
How to download a file from the FTP server using FtpGetFile
Detecting changes in connections to removable drives (VFP9)
Splash Screen for the VFP application
Custom HttpRequest class (WinINet)
Mapping and disconnecting network drives
How to activate Windows Calculator
Enumerating raw input devices attached to the system (keyboard, mouse, human interface device)
How to convert a bitmap file to monochrome format (1 bpp)
Custom HttpRequest class (WinHTTP)
Establishing connection using the SQLDriverConnect
GDI+: copying to the Clipboard (a) image of active FoxPro window/form, (b) image file
Using EnumPrinters function to enumerate locally installed printers
Using Font and Text functions
Using WM_COPYDATA for interprocess communication (VFP9)
Displaying bitmap using the AlphaBlend function
Extensible Storage Engine class library
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: 108  
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 (72.44.48.122)
55.1 min.Example: 'Obtaining list of tables stored in an ODBC Data Source'
3.72 hrs.Example: 'How to test file attributes (key method for FileExists and DirectoryExists routines)'
 Function: 'GetEnhMetaFileHeader'
7.66 hrs.Example: 'Displaying hypertext links with the SysLink control (VFP9, Comctl32.dll)'
11 hrs.Example: 'How to download this reference`s archive through WinInet functions using InternetOpenUrl'
11.82 hrs.Function: 'Sleep'
Function group: 'Process and Thread'
14.83 hrs.Function: 'DeleteDC'
Function group: 'Device Context'
1 day(s)Example: 'How to ping a remote site using ICMP API calls'
 Function: 'GetMenuContextHelpId'
 Function: 'GetMenu'
Function group: 'Menu'
Google
Advertise here!