Using Win32 functions in Visual FoxPro Image Gallery
Code examples:
How to create transparent areas inside a form -- punching holes in the form
How to empty the Recycle Bin
How to obtain the number of rows affected by remote UPDATE, INSERT or DELETE statement
Reading and setting the priority class values for the current process and thread
Time in milliseconds represented as string (e.g. 1 hour 24 min 36 sec)
Verifying a file using the Authenticode policy provider
Converting an integer value to a hexadecimal string
Enumerating ODBC drivers available on the local computer
Enumerating sessions established on a server
GDI+: printing image file
How to view system icons for the classes installed on the local machine
Power capabilities of the system: battery, UPS, sleep and hibernation modes, processor throttling
GDI+: rotating images using matrix transformations
PocketPC: custom RAPI class for executing routines on remote Windows CE device
Using GetSysColor
Using shared memory to exchange data between two FoxPro applications
Adding supplementary data to AVI files
Enumerating Volumes and Volume Mounting Points (NTFS)
GDI+: reading and writing metadata in JPEG and TIFF files
GDI+: retrieving list of available image encoders and image decoders
GDI+: creating scaled copy of image file
Obtaining a handle to the desktop associated with the calling thread
Obtaining OS memory performance information
Testing MS Internet Explorer version installed
Comparing file times

User rating: 10/10 (2 votes)
Rate this code sample:
  • ~
More code examples    Listed functions    Add comment     W32 Constants      Translate this page Printer friendly version of this code sample
 
DO decl
 
*| typedef struct _FILETIME { 
*|     DWORD dwLowDateTime; 
*|     DWORD dwHighDateTime; 
*| } FILETIME, *PFILETIME; 
 
    LOCAL lcTime1, lcTime2, lnResult
 
    lcTime1 = GetLastWriteTime ("c:\i386\Comctl32.dl_")
    lcTime2 = GetLastWriteTime ("c:\winnt\system32\Comctl32.dll")
    lnResult = CompareFileTime (lcTime1, lcTime2)
 
    DO CASE
    CASE lnResult = -1
        ? "First file time is less than second file time"
    CASE lnResult = 0
        ? "First file time is equal to second file time"
    CASE lnResult = 1
        ? "First file time is greater than second file time"
    ENDCASE
RETURN
 
FUNCTION  GetLastWriteTime (lcFilename)
#DEFINE OF_READ   0
#DEFINE OF_WRITE  1
    LOCAL hFile, lcBuffer, lcCreationTm, lcLastAccessTm, lcLastWriteTm
 
    * 8 bytes - size of FILETIME structure
       STORE Repli(Chr(0),8) TO lcCreationTm, lcLastAccessTm, lcLastWriteTm
 
    lcBuffer = REPLI (Chr(0), 250)
    hFile = OpenFile (lcFilename, @lcBuffer, OF_READ)
    IF hFile > 0
        = GetFileTime (hFile, @lcCreationTm, @lcLastAccessTm, @lcLastWriteTm)
        = CloseHandle (hFile)
    ELSE
        *  5 = Access is denied
        * 32 = The file is being used by another process
    ENDIF
RETURN lcLastWriteTm
 
PROCEDURE  decl
    DECLARE INTEGER CompareFileTime IN kernel32;
        STRING lpFileTime1, STRING lpFileTime2
 
    DECLARE GetFileTime IN kernel32;
        INTEGER hFile, STRING @lpCreationTime,;
        STRING @lpLastAccessTime, STRING @lpLastWriteTime
 
    DECLARE INTEGER OpenFile IN kernel32;
        STRING lpFileName, STRING @lpReOpenBuff,;
        INTEGER wStyle
 
    DECLARE INTEGER CloseHandle IN kernel32 INTEGER hObject
 
 

User rating: 10/10 (2 votes)
Rate this code sample:
  • ~
1604 bytes  
Created: 2001-10-25 20:39:34  
Modified: 2001-10-25 20:44:30  
Visits in 7 days: 55  
Listed functions:
CloseHandle
CompareFileTime
GetFileTime
OpenFile
Printer friendly API declarations
My comment:
When using CompareFileTime there is no need to untwist retrieved FILETIME records into year-month-day-etc. values
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-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 (54.234.126.92)
9.58 hrs.Function: 'GetCurrentHwProfile'
 Example: 'Comparing dimensions of the VFP main window with _SCREEN properties'
10.89 hrs.Function: 'DeleteService'
Function group: 'Service'
 Example: 'Class library providing access to the System Registry'
12.23 hrs.Example: 'Accessing LSA Policy object (Local Security Authority)'
 Function: 'GlobalAlloc'
13.91 hrs.Example: 'How to disable the Windows Clipboard (VFP9)'
 Example: 'Changing file attributes'
15.6 hrs.Example: 'MapiSendMail class for Visual FoxPro application'
15.91 hrs.Example: 'Creating a clipping region from the path selected into the device context of a form'
Google
Advertise here!