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:
Creating a file, then moving it to another destination
How to convert a bitmap file to monochrome format (1 bpp)
How to set Creation Date/Time for a folder (WinNT)
HOWTO: Use the Win32 API to Access File Dates and Times
Monitoring changes occurring within a directory
Obtaining physical parameters for a drive: sectors, clusters, cylinders...
Peer-to-peer LAN messenger built with Mailslot API functions
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
Testing serial ports
Using InternetSetFilePointer when resuming interrupted download from the Internet
Using mailslots to send messages on the network
Using named pipes for interprocess communication
Using the CreateFile
Using the DeleteFile
Vertical Label control
How to set Creation Date/Time for a folder (WinNT)

User rating: 0/10 (0 votes)
Rate this code sample:
  • ~
More code examples    Listed functions    Add comment     W32 Constants      Translate this page Printer friendly version of this code sample
Before you begin:
This code sample has been translated from VB code. The original link is Modifying the Date/Time of Folders and Files Under Windows NT+ at VBNet developers resource centre.

 
? ChangeFolderFileDate("c:\myfolder", DATETIME())
 
FUNCTION ChangeFolderFileDate(cFolder, tDate)
#DEFINE GENERIC_WRITE  0x40000000 
#DEFINE GENERIC_READ   0x80000000
#DEFINE FILE_SHARE_DELETE 4
#DEFINE FILE_SHARE_READ   1
#DEFINE OPEN_EXISTING     3
#DEFINE FILE_FLAG_BACKUP_SEMANTICS 0x02000000
 
    DECLARE INTEGER CreateFile IN kernel32;
        STRING lpFileName, INTEGER dwDesiredAccess,;
        INTEGER dwShareMode, INTEGER lpSecurityAttr,;
        INTEGER dwCreationDisp, INTEGER dwFlagsAndAttrs,;
        INTEGER hTemplateFile
 
    LOCAL hFolder
 
    * use CreateFile for Windows NT/XP/2000 and OpenFile for Win9/Me
    hFolder = CreateFile(cFolder, GENERIC_WRITE+GENERIC_READ,;
        FILE_SHARE_READ+FILE_SHARE_DELETE, 0, OPEN_EXISTING,;
        FILE_FLAG_BACKUP_SEMANTICS, 0)
 
    IF hFolder = -1  && failed to open
        RETURN .F.   && use GetLastError to get an error code
    ENDIF
 
    DECLARE INTEGER CloseHandle IN kernel32 INTEGER hObject
 
    DECLARE INTEGER SetFileTime IN kernel32;
        INTEGER hFile, STRING lpCreationTime,;
        STRING lpLastAccessTime, STRING lpLastWriteTime
 
    DECLARE INTEGER SystemTimeToFileTime IN kernel32;
        STRING lpSystemTime, STRING @lpFileTime
 
    DECLARE INTEGER LocalFileTimeToFileTime IN kernel32;
        STRING lpLocalFileTime, STRING @lpFileTime
 
    LOCAL cSysTime, cFileTime, nResult
    cFileTime = Repli(Chr(0),8)
 
    cSysTime = num2buf(Year(tDate)) + num2buf(Month(tDate)) +;
        num2buf(DOW(tDate,0)) + num2buf(Day(tDate)) +;
        num2buf(Hour(tDate)) + num2buf(Minute(tDate)) + Repli(Chr(0),4)
 
    * converting SYSTEMTIME data to FILITIME
    = SystemTimeToFileTime(cSysTime, @cFileTime)
 
    * in case your local time is different from UTC
    = LocalFileTimeToFileTime(cFileTime, @cFileTime)
 
    * file handle, created, last-access, last-write
    nResult = SetFileTime(hFolder, cFileTime, 0,0)
 
    = CloseHandle(hFolder)  && important
RETURN (nResult <> 0)
 
FUNCTION num2buf(nValue)
RETURN Chr(MOD(m.nValue,256)) + CHR(INT(m.nValue/256))
 
 
 

User rating: 0/10 (0 votes)
Rate this code sample:
  • ~
1962 bytes  
Created: 2003-04-24 21:03:10  
Modified: 2003-04-24 21:08:19  
Visits in 7 days: 120  
Listed functions:
CloseHandle
CreateFile
GetLastError
LocalFileTimeToFileTime
OpenFile
SetFileTime
SystemTimeToFileTime
Printer friendly API declarations
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.242.188.217)
3.8 hrs.Example: 'How to display picture stored in enhanced-format metafile (*.emf)'
 Function: 'GdipDrawPieI'
Function group: 'GDI+ Graphics'
4.04 hrs.Function: 'SetThreadPriority'
 Function: 'RegOpenKeyEx'
5.65 hrs.Example: 'How to make a VFP form fading out when released (GDI version)'
 Example: 'Creating an Open dialog box to specify the drive, directory, and name of a file to open (Shell32 version)'
7.53 hrs.Function: 'PeekMessage'
Function group: 'Message and Message Queue'
8.23 hrs.Function: 'CreateNamedPipe'
8.24 hrs.Example: 'Capturing keyboard activity of another application with the Raw Input API (VFP9)'
12.57 hrs.Example: 'Using shared memory to exchange data between two FoxPro applications'
Google
Advertise here!