Using Win32 functions in Visual FoxPro Image Gallery
Code examples:
How to view system icons for the classes installed on the local machine
Locking the workstation
MapiSendMail class for Visual FoxPro application
Pocket PC: custom RAPI class for operating with the System Registry
Power capabilities of the system: battery, UPS, sleep and hibernation modes, processor throttling
Verifying a file using the Authenticode policy provider
Attaching menu to a top-level form
Converting command-line string to a set of Unicode argument strings (WinNT only)
Customizing the frame of top-level form: removing the standard frame (VFP9, Vista)
GDI+: creating scaled copy of image file
GDI+: retrieving list of available image encoders and image decoders
How to enumerate terminal servers within the specified Windows domain
How to release and renew a lease on an IP address previously obtained through Dynamic Host Configuration Protocol (DHCP)
Pocket PC: base class
Pocket PC: retrieving data from the Contacts Database
Quering waveform-audio output devices
Saving HKEY_LOCAL_MACHINE\\Software\\ODBC Registry Entries to an XML file
Testing an ODBC connection for supporting specific functionality
Converting an integer value to a hexadecimal string
Enumerating Processes -- WinNT
How to create a desktop shortcut (shell link)
Retrieving various system metrics
Using shared memory to exchange data between two FoxPro applications
Winsock: retrieving the standard host name and IP address for the local machine
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: 151  
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 (184.72.184.104)
5 sec.Function: 'SQLGetDiagRec'
Function group: 'ODBC API'
5.58 hrs.Example: 'Converting strings between ANSI and OEM'
 Banners
7.24 hrs.Example: 'Retrieving graphic capabilities of default printer'
 Example: 'Using the CreateFile'
9.14 hrs.Example: 'Bitmap Class for Visual FoxPro application'
 Function: 'JetBeginTransaction'
Function group: 'Extensible Storage Engine (ESE, Jet Blue)'
12.76 hrs.Function: 'CeGetStoreInformation'
Function group: 'Remote Application Programming (RAPI)'
 Example: 'How to make a VFP form fading out when released (GDI+ version)'
15.3 hrs.Example: 'Custom HttpRequest class (WinHTTP)'
Google
Advertise here!