Using Win32 functions in Visual FoxPro Image Gallery
Code examples:
How to control Adobe Reader 9.0 (SDI mode) from VFP application
How to download a file from HTTP server using URL Monikers functions
Using the GradientFill function
Using the IsWindowEnabled function
Winsock: how to retrieve a service information corresponding to a port
Accessing examples contained in this reference through Web Services
Configuring DEVMODE structure for a printer
Customizing the frame of top-level form: removing the standard frame (VFP9, Vista)
Reading Internet Query options
Retrieving the priority class for the current process
GDI+: Drawing a Pie Chart
GDI+: printing vertical text on VFP reports via generated images (VFP8)
How to start the screen saver and how to find whether the screen saver is active
Obtaining a handle to the desktop associated with the calling thread
Passing data records between VFP applications via the Clipboard
Printing text on the main VFP window
Returning some basic information for the specified INF file
Verifying a file using the Authenticode policy provider
WAV file recorder
Yet another modal dialog: now HTML-based
An alternative way of setting Form.Closable to False
Displaying the drive type value
How to display a Task Dialog (Vista)
How to get Special Folders paths
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: 83  
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 (184.73.74.47)
6.76 hrs.Function: 'GetQueueStatus'
Function group: 'Message and Message Queue'
 Example: 'Using GetCompressedFileSize (WinNT only)'
7.27 hrs.Function: 'EmptyClipboard'
Function group: 'Clipboard'
 Example: 'Converting image file to .ICO file'
8.91 hrs.Example: 'How to hot-track menu item selection in top-level form (requires VFP9)'
 Function: 'StretchDIBits'
13.8 hrs.Article: 'ApiViewer for Visual FoxPro '
 Function: 'LookupAccountSid'
 Function: 'CreateCompatibleBitmap'
14.61 hrs.Function: 'Shell_GetImageLists'
Google
Advertise here!