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:
Copying files as a transacted operation (Vista)
CopyFileTransacted
..msdn    Add comment     W32 Constants      Translate this page
Copies an existing file to a new file as a transacted operation, notifying the application of its progress through a callback function.
Code examples:
Copying files as a transacted operation (Vista)
Declaration:
BOOL WINAPI CopyFileTransacted(
  __in      LPCTSTR lpExistingFileName,
  __in      LPCTSTR lpNewFileName,
  __in_opt  LPPROGRESS_ROUTINE lpProgressRoutine,
  __in_opt  LPVOID lpData,
  __in_opt  LPBOOL pbCancel,
  __in      DWORD dwCopyFlags,
  __in      HANDLE hTransaction
);
FoxPro declaration:
DECLARE INTEGER CopyFileTransacted IN kernel32;
    STRING lpExistingFileName,;
    STRING lpNewFileName,;
    INTEGER lpProgressRoutine,;
    INTEGER lpData,;
    INTEGER pbCancel,;
    INTEGER dwCopyFlags,;
    INTEGER hTransaction
Parameters:
lpExistingFileName [in]
The name of an existing file.

lpNewFileName [in]
The name of the new file.

lpProgressRoutine [in, optional]
The address of a callback function of type LPPROGRESS_ROUTINE that is called each time another portion of the file has been copied.

lpData [in, optional]
The argument to be passed to the callback function. This parameter can be NULL.

pbCancel [in, optional]
If this flag is set to TRUE during the copy operation, the operation is canceled. Otherwise, the copy operation will continue to completion.

dwCopyFlags [in]
Flags that specify how the file is to be copied.

hTransaction [in]
A handle to the transaction.
Return value:
If the function succeeds, the return value is nonzero.
Usage:
LOCAL cSrc, cDst, nResult
cSrc = "c:\temp\test.txt"
cDst = "c:\temp\test1.txt"

nResult = CopyFileTransacted( cSrc, cDst, 0, 0, 0,;
    BITOR(COPY_FILE_FAIL_IF_EXISTS,;
    COPY_FILE_OPEN_SOURCE_FOR_WRITE),;
    m.hTransaction )

IF nResult = 0
    RollbackTransaction( m.hTransaction )
ELSE
    CommitTransaction( m.hTransaction )
ENDIF
My comment:
Requires Windows Vista.

Obviously the callback side of this function cannot be exploited in plain FoxPro code. Thus the lpProgressRoutine must be set to 0.

Based on call`s completion (also some application logic may become involved), either CommitTransaction or RollbackTransaction is applied to finalize or cancel the process of copying.

See also: CreateTransaction, CommitTransaction, RollbackTransaction, CopyFile, DeleteFileTransacted
Word Index links for the CopyFileTransacted :
Translate this page:
  Spanish    Portuguese    German    French    Italian  
FreeTranslation.com offers instant, free translations of text or web pages.
Created: 2008-12-04 16:00:25
Modified: 2010-05-24 12:08:13
Visited in last 7 days: 15
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.81.237.159)
13 sec.Function: 'CM_Connect_Machine'
27 sec.
Function group: 'Font and Text'
40 sec.Function: 'GetAclInformation'
53 sec.Function: 'GetMenuItemInfo'
1.07 min.
Function group: 'Dynamic-Link Library'
1.23 min.Function: 'CM_Disconnect_Machine'
1.4 min.Function: 'CeFindFirstFile'
1.58 min.Function: 'DuplicateHandle'
1.75 min.Function: 'EnumPrintProcessors'
1.93 min.Function: 'CeRegCreateKeyEx'
Google
Advertise here!