Using Win32 functions in Visual FoxPro Image Gallery
Handle and Object
..msdn
CloseHandle
DuplicateHandle
GetHandleInformation
SetHandleInformation
Code examples:
Comparing file times
Copying files as a transacted operation (Vista)
Creating a console window for Visual FoxPro application
Creating a file, then moving it to another destination
Creating a mailslot
Enumerating Processes -- Win9*
Enumerating Processes -- WinNT
How to check whether the system is 32-bit or 64-bit
How to convert a bitmap file to monochrome format (1 bpp)
How to enable the SE_SHUTDOWN_NAME privilege for the application
How to find when the application started
How to make application automatically close all documents it opened
How to prevent users from accessing the Windows Desktop and from switching to other applications
How to run FoxPro application under different user name (impersonating user)
How to set Creation Date/Time for a folder (WinNT)
How to Start a Process as Another User (NT/XP/2K)
How to suspend or hibernate your system
HOWTO: Use the Win32 API to Access File Dates and Times
Locking and unlocking file of a VFP table
Monitoring changes occurring within a directory
Moving shortcut to a specified position on the Windows Desktop
Obtaining I/O counts for the current process
Obtaining names and positions for shortcuts located on the Windows Desktop
Obtaining physical parameters for a drive: sectors, clusters, cylinders...
Passing data records between VFP applications via the Clipboard
Peer-to-peer LAN messenger built with Mailslot API functions
Reading and setting system access privileges for the current process
Reading and setting the priority class values for the current process and thread
Retrieving file information for the VFP executable running
Running MSDOS Shell as a child process with redirected input and output (smarter RUN command)
Setting the date and time that a file was created
Starting external program from VFP and waiting for its termination
Storing content of the Clipboard to a bitmap file
Storing screen shot of a form to bitmap file
Subclassing CommandButton control to create BackColor property
Terminating all running applications from a VFP program
Testing serial ports
Using File Mapping for enumerating files opened by Visual FoxPro
Using GetFileSize
Using InternetSetFilePointer when resuming interrupted download from the Internet
Using mailslots to send messages on the network
Using named pipes for interprocess communication
Using shared memory to exchange data between two FoxPro applications
Using the CreateFile
Using the DeleteFile
Using the Semaphore object
Using the Semaphore object to allow only one instance of VFP application running
Vertical Label control
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: 61  
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 (50.16.166.175)
2 sec.Links
Page 3
5 sec.Function: 'GetThreadPriority'
Function group: 'Process and Thread'
5.05 hrs.Function: 'WTSFreeMemory'
Function group: 'Terminal Services'
 Example: 'Copying picture of the active form to the Clipboard using Enhanced Metafile API functions'
 Example: 'Displaying animated images on FoxPro form with BitBlt and StretchBlt functions'
5.93 hrs.Function: 'CeSetFilePointer'
Function group: 'Remote Application Programming (RAPI)'
 Function: 'GdipDeletePen'
Function group: 'GDI+ Pen'
6.14 hrs.Function: 'GetFileVersionInfoSize'
Function group: 'Version Information'
 Function: 'DeleteObject'
6.58 hrs.Function: 'TaskDialog'
Google
Advertise here!