Hi,
How to find out the date of the last file change ?
cFILE := "C:\INST_NFE\MyProgam.exe"
aDIR := DIRECTORY( cFILE )
dEXE := aDIR[1] [3]
dDateVersion := DTOC( dEXE )
local oFs, oFile, cFile
oFs := CreateObject( "Scripting.FileSystemObject" )
cFile := "c:\fwh\samples\maria01.prg"
if oFs:FileExists( cFile )
oFile := oFs:GetFile( cFile )
? oFile:DateCreated, oFile:DateLastModified, oFile:DateLastAccessed
else
? cFile + " does not exist"
endif
#include "Fivewin.ch"
FUNCTION MAIN()
LOCAL dDate
dDate := FCREATEDATE( "C:\TEST.PDF" )
MsgStop( dDate )
RETURN NIL
#pragma BEGINDUMP
#include <windows.h>
#include "hbapi.h"
HB_FUNC( FCREATEDATE )
{
HANDLE hFile ;
WIN32_FIND_DATA wfd ;
SYSTEMTIME st ;
hFile = FindFirstFile( hb_parc( 1 ), &wfd ) ;
if ( hFile != INVALID_HANDLE_VALUE ) {
FileTimeToSystemTime( &wfd.ftCreationTime, &st ) ;
FindClose( hFile ) ;
}
else {
st.wYear = 0 ;
st.wMonth = 0 ;
st.wDay = 0 ;
}
hb_retd( st.wYear, st.wMonth, st.wDay ) ;
}
#pragma ENDDUMP
#include "Fivewin.ch"
FUNCTION MAIN()
LOCAL dDate
dDate := FCREATEDATE( "C:\TEST.PDF" )
MsgStop( dDate )
dDate := FLACCESSDATE( "C:\TEST.PDF" )
MsgStop( dDate )
dDate := FLWRITEDATE( "C:\TEST.PDF" )
MsgStop( dDate )
RETURN NIL
#pragma BEGINDUMP
#include <windows.h>
#include "hbapi.h"
HB_FUNC( FCREATEDATE )
{
HANDLE hFile ;
WIN32_FIND_DATA wfd ;
SYSTEMTIME st ;
hFile = FindFirstFile( hb_parc( 1 ), &wfd ) ;
if ( hFile != INVALID_HANDLE_VALUE ) {
FileTimeToSystemTime( &wfd.ftCreationTime, &st ) ;
FindClose( hFile ) ;
}
else {
st.wYear = 0 ;
st.wMonth = 0 ;
st.wDay = 0 ;
}
hb_retd( st.wYear, st.wMonth, st.wDay ) ;
}
HB_FUNC( FLACCESSDATE )
{
HANDLE hFile ;
WIN32_FIND_DATA wfd ;
SYSTEMTIME st ;
hFile = FindFirstFile( hb_parc( 1 ), &wfd ) ;
if ( hFile != INVALID_HANDLE_VALUE ) {
FileTimeToSystemTime( &wfd.ftLastAccessTime, &st ) ;
FindClose( hFile ) ;
}
else {
st.wYear = 0 ;
st.wMonth = 0 ;
st.wDay = 0 ;
}
hb_retd( st.wYear, st.wMonth, st.wDay ) ;
}
HB_FUNC( FLWRITEDATE )
{
HANDLE hFile ;
WIN32_FIND_DATA wfd ;
SYSTEMTIME st ;
hFile = FindFirstFile( hb_parc( 1 ), &wfd ) ;
if ( hFile != INVALID_HANDLE_VALUE ) {
FileTimeToSystemTime( &wfd.ftLastWriteTime, &st ) ;
FindClose( hFile ) ;
}
else {
st.wYear = 0 ;
st.wMonth = 0 ;
st.wDay = 0 ;
}
hb_retd( st.wYear, st.wMonth, st.wDay ) ;
}
#pragma ENDDUMP
Return to FiveWin for Harbour/xHarbour
Users browsing this forum: Google [Bot] and 68 guests