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:
Using the CopyFile
CopyFile
..msdn    Add comment     W32 Constants      Translate this page
This function copies an existing file to a new file
Code examples:
Using the CopyFile
Declaration:
BOOL CopyFile(
    LPCTSTR lpExistingFileName, 
    LPCTSTR lpNewFileName, 
    BOOL bFailIfExists );
FoxPro declaration:
DECLARE INTEGER CopyFile IN kernel32;
    STRING  lpExistingFileName,;
    STRING  lpNewFileName,;
    INTEGER bFailIfExists

Parameters:
lpExistingFileName
[in] Long pointer to a null-terminated string that specifies the name of an existing file.

lpNewFileName
[in] Long pointer to a null-terminated string that specifies the name of the new file.

bFailIfExists
[in] Boolean that specifies how this operation is to proceed if a file of the same name as that specified by lpNewFileName already exists. If this parameter is TRUE and the new file already exists, the function fails. If this parameter is FALSE and the new file already exists, the function overwrites the existing file and succeeds
Return value:
Nonzero indicates success. Zero indicates failure
Usage:
? CopyFile("C:\Autoexec.bat", "C:\Autoexec.cpy", 0)

My comment:
The native COPY FILE command cannot copy a file that is open (3. File is in use).

With the CopyFile, both the source and the destination can stay open -- like text files modified, DBF files in use and so on -- and still the copying occurs. Of course, any uncommitted changes do not appear in the target file.

To copy files with a progress dialog box use the SHFileOperation function.

See also: CopyFileTransacted
Word Index links for the CopyFile :
Translate this page:
  Spanish    Portuguese    German    French    Italian  
FreeTranslation.com offers instant, free translations of text or web pages.
Created: 2001-07-12 12:00:00
Modified: 2010-05-24 11:59:24
Visited in last 7 days: 33
User Contributed Notes:
Catjoke | 2001-10-01 09:33:30
CopyFile is a perfect function.

You can redirect a remote barcode printer in Novell network by using CopyFile. (Even you don"t need install the Printer driver!!)
For example, if you write a text file according to barcode printer gride, such as heat control, label tab space etc.

CopyFile(abc.txt, [\\UserB\Datamax])

Note:
The UserB PC cannot use CopyFile API to call itself Printer nor call LPT1, I donno why but observe it in real test.

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.38), the Open Source standard SQL database, AceHTML Freeware Version 4, freeware HTML Editor of choice.   Hosted by Korax Online Inc.
Last Topics Visited (54.234.247.118)
14 sec.Function: 'GetAncestor'
29 sec.Function: 'GdipDrawImageRectI'
44 sec.Function: 'GetAdaptersAddresses'
59 sec.Function: 'DllInstall'
1.23 min.Function: 'GetFileVersionInfoSize'
1.48 min.Function: 'CloseClipboard'
1.75 min.Function: 'GetBoundsRect'
2 min.Function: 'GetIpAddrTable'
2.27 min.Function: 'GetLocaleInfo'
2.53 min.Function: 'GetMappedFileName'
Google
Advertise here!