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:
ReplaceFile
..msdn    Add comment     W32 Constants      Translate this page
Replaces one file with another file, with the option of creating a backup copy of the original file.
Code examples:
Declaration:
BOOL WINAPI ReplaceFile(
  __in        LPCTSTR lpReplacedFileName,
  __in        LPCTSTR lpReplacementFileName,
  __in_opt    LPCTSTR lpBackupFileName,
  __in        DWORD dwReplaceFlags,
  __reserved  LPVOID lpExclude,
  __reserved  LPVOID lpReserved
);
FoxPro declaration:
DECLARE INTEGER ReplaceFileA IN kernel32;
    STRING lpReplacedFileName,;
    STRING lpReplacementFileName,;
    STRING lpBackupFileName,;
    LONG dwReplaceFlags,;
    INTEGER lpExclude,;
    INTEGER lpReserved
Parameters:
lpReplacedFileName [in]
The name of the file to be replaced.

lpReplacementFileName [in]
The name of the file that will replace the lpReplacedFileName file.

lpBackupFileName [in, optional]
The name of the file that will serve as a backup copy of the lpReplacedFileName file. If this parameter is NULL, no backup file is created.

dwReplaceFlags [in]
The replacement options.

lpExclude
Reserved for future use.

lpReserved
Reserved for future use.
Return value:
If the function succeeds, the return value is nonzero.
Usage:
#DEFINE REPLACEFILE_WRITE_THROUGH 1

LOCAL cToBeReplaced, cReplaceWith, cBak

cToBeReplaced = "c:\temp\test123.txt"
cReplaceWith = "c:\temp\test123456.txt"
cBak = "c:\temp\test123.bak"

IF ReplaceFileA(cToBeReplaced, cReplaceWith, cBak,;
    REPLACEFILE_WRITE_THROUGH, 0, 0) = 0
    ? GetLastError()
ENDIF
My comment:
In VFP use the ASCII version for this function, unless you specifically convert the first three input parameters (file names) into Unicode strings.
Word Index links for the ReplaceFile :
Translate this page:
  Spanish    Portuguese    German    French    Italian  
FreeTranslation.com offers instant, free translations of text or web pages.
Created: 2008-12-08 13:19:53
Modified: 2008-12-08 13:24:38
Visited in last 7 days: 11
User Contributed Notes:
There are no notes on this subject.


Copyright 2001-2017 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.6.37), the Open Source standard SQL database, AceHTML Freeware Version 4, freeware HTML Editor of choice.   Hosted by Korax Online Inc.
Last Topics Visited (54.156.67.122)
26 sec.Function: 'GetPrinter'
1.55 min.Function: 'FileIconInit'
Google
Advertise here!