Using Win32 functions in Visual FoxPro Image Gallery
File Management
..msdn
CopyFile
CopyFileTransacted
CreateDirectory
CreateFile
CreateFileTransacted
CreateHardLink
CreateSymbolicLink
DeleteFile
DeleteFileTransacted
FindClose
FindCloseChangeNotification
FindFirstChangeNotification
FindFirstFile
FindNextChangeNotification
FindNextFile
FlushFileBuffers
GetBinaryType
GetCurrentDirectory
GetDriveType
GetFileAttributes
GetFileAttributesEx
GetFileInformationByHandle
GetFileType
GetFullPathName
GetLongPathName
GetShortPathName
GetTempFileName
GetTempPath
LockFile
MoveFile
MoveFileTransacted
OpenFile
QueryDosDevice
ReadDirectoryChangesW
ReadFile
RemoveDirectory
RemoveDirectoryTransacted
ReplaceFile
SearchPath
SetCurrentDirectory
SetEndOfFile
SetFileAttributes
SetFilePointer
SetFilePointerEx
SetSearchPathMode
UnlockFile
WriteFile
_lclose
_lopen
Code examples:
Comparing file times
How to set Creation Date/Time for a folder (WinNT)
Locking and unlocking file of a VFP table
Passing data records between VFP applications via the Clipboard
Retrieving file information for the VFP executable running
Setting the date and time that a file was created
Using File Mapping for enumerating files opened by Visual FoxPro
Using GetFileSize
Using InternetSetFilePointer when resuming interrupted download from the Internet
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: 88  
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 (107.22.156.205)
3 sec.Example: 'How to display advanced Task Dialog (Vista)'
8 sec.Example: 'Reading and setting Environment variables'
6.74 hrs.Function: 'CeMoveFile'
6.75 hrs.Function: 'FindNextFile'
7.09 hrs.Function: 'SetCapture'
7.1 hrs.Example: 'Accessing LSA Policy object (Local Security Authority)'
 Function: 'GetWindowLong'
8.36 hrs.Function: 'LoadString'
Function group: 'Resource'
 Example: 'How to delete all print jobs for a printer'
10.03 hrs.Function: 'GlobalLock'
Google
Advertise here!