 |
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: |
 |
|
|
 |
 |
| 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: |
 |
|
 |
 |
| • |
 |
| Created: | 2008-12-04 16:00:25 | | Modified: | 2010-05-24 12:08:13 | Visited in last 7 days: 243 |