网站首页  词典首页

请输入您要查询的函数:

 

术语 movefilewithprogress
释义 MoveFileWithProgress
语法:
C++
BOOL WINAPI MoveFileWithProgress(
__in LPCTSTR lpExistingFileName,
__in_opt LPCTSTR lpNewFileName,
__in_opt LPPROGRESS_ROUTINE lpProgressRoutine,
__in_opt LPVOID lpData,
__in DWORD dwFlags
);
MoveFileWithProgress功能
移动文件或目录,包括其子女。您可以提供一个回调函数,它接收进度通知。
作为一个要执行此操作的事务操作,请使用MoveFileTransacted功能。
参数
lpExistingFileName [in]
现有的文件或在本地计算机上的目录名称。
如果dwFlags指定MOVEFILE_DELAY_UNTIL_REBOOT,该文件不能存在于远程共享,因为拖延行动是在网络可用执行。
在此函数的ANSI版本,名称被限制为MAX_PATH字符。为了延长此限制,以32,767宽字符,调用的功能和前面加上“\\ Unicode版本\\?\\”的路径。有关更多信息,请参见命名一个文件。
lpNewFileName [中,可选]
该文件或在本地计算机上的目录的新名称。
当移动一个文件,lpNewFileName可以在不同的文件系统或卷。如果lpNewFileName在另一个驱动器上,您必须设置在dwFlags的MOVEFILE_COPY_ALLOWED标志。
当移动一个目录,lpExistingFileName和lpNewFileName必须在同一个驱动器。
如果dwFlags指定MOVEFILE_DELAY_UNTIL_REBOOT和lpNewFileName是NULL,MoveFileWithProgress登记lpExistingFileName要删除系统重新启动时。函数失败如果它不能访问注册表来存储关于删除操作的信息。如果lpExistingFileName指的是一个目录,系统目录中删除,只有在重新启动该目录是空的。
lpProgressRoutine [中,可选]
一个 CopyProgressRoutine回调函数,每次调用该文件的另一部分已被移动指针。回调函数可以是有用的,如果您提供一个用户界面,显示了该行动的进展。此参数可以为NULL。
lpData [中,可选]
一个参数传递给CopyProgressRoutine回调函数。此参数可以为NULL。
dwFlags [in]
此举选项。此参数可以是一个或多个下列值。
ValueMeaning
MOVEFILE_COPY_ALLOWED
2(0x2)如果该文件被移动到一个不同的卷,功能模拟使用CopyFile和DeleteFile函数的做法。
此值不能用于MOVEFILE_DELAY_UNTIL_REBOOT。
MOVEFILE_CREATE_HARDLINK
16(0x10)保留供以后使用。
MOVEFILE_DELAY_UNTIL_REBOOT
4(0x4)系统不动,直到重新启动操作系统的文件。该系统后立即移动Autochk的执行文件,但在建立任何页面文件。因此,此参数使函数删除以前的创业分页文件。
此值才能使用过程中,如果一个用户谁属于管理员组或LocalSystem帐户的上下文。
此值不能用于MOVEFILE_COPY_ALLOWED。
MOVEFILE_FAIL_IF_NOT_TRACKABLE
32(0x20)的功能失败如果源文件是一个链接的来源,但文件无法移动后跟踪。出现这种情况如果目标是用FAT文件系统格式化的卷。
MOVEFILE_REPLACE_EXISTING
1(0x1)如果一个文件名为lpNewFileName存在,功能替换的lpExistingFileName文件的内容其内容。
此值不能使用,如果lpNewFileName或lpExistingFileName名称目录。
MOVEFILE_WRITE_THROUGH
8(0x8)函数不返回,直到该文件实际上已提出在磁盘上。
设置此值,此举为保障和复制执行删除操作刷新到磁盘之前,该函数返回。在刷新发生在复制操作结束。
此值如果MOVEFILE_DELAY_UNTIL_REBOOT没有设置生效。
返回值
如果函数成功,返回值为非零。
如果函数失败,返回值是零。为了获得更多错误信息,调用GetLastError。
当移动横跨卷文件,如果lpProgressRoutine返回PROGRESS_CANCEL由于用户取消操作,MoveFileWithProgress将返回零,而且GetLastError将返回ERROR_REQUEST_ABORTED。现有的文件保持不变。
当移动横跨卷文件,如果lpProgressRoutine返回PROGRESS_STOP由于用户停止操作,MoveFileWithProgress将返回零,而且GetLastError将返回ERROR_REQUEST_ABORTED。现有的文件保持不变。
备注
该MoveFileWithProgress功能协调与跟踪服务环节的运作,使连结来源可以追踪到这些被移动。
删除或重命名一个文件,您必须或者删除的文件的权限或删除父目录儿童权限。如果您设置了所有除删除和删除子和新文件的ACL访问目录中继承,那么您应该能够创建,而不能删除一个文件。但是,您就可以创建一个文件,您将得到所有的访问您在处理返回的时候您创建该文件给您的要求。如果您要求删除您的时间创建的文件权限,可以删除或重命名与该处理,但不与任何其他文件。
要编译的应用程序使用此函数,定义为0x0500或更高_WIN32_WINNT宏。有关详细信息,请参阅使用Windows头。
要求:
最低支持:client-Windows 2000专业版
最低支持server-Windows 2000服务器
HeaderWinBase.h(头文件:winuser.h)
LibraryKernel32.lib
DLLKernel32.dll
Unicode和ANSI namesMoveFileWithProgressW(Unicode)和MoveFileWithProgressA(ANSI)的
参见
CopyFileEx
CopyProgressRoutine
文件管理函数
MoveFileEx
MoveFileTransacted
如果有任何问题和意见,请发送给微软(wsddocfb@microsoft.com)
生成日期:2009年9月3日
==英文原文==MoveFileWithProgress Function
Moves a file or directory, including its children. You can provide a callback function that receives progress notifications.
To perform this operation as a transacted operation, use the MoveFileTransacted function.
Syntax
C++
BOOL WINAPI MoveFileWithProgress(
__in LPCTSTR lpExistingFileName,
__in_opt LPCTSTR lpNewFileName,
__in_opt LPPROGRESS_ROUTINE lpProgressRoutine,
__in_opt LPVOID lpData,
__in DWORD dwFlags
);
Parameters
lpExistingFileName [in]
The name of the existing file or directory on the local computer.
If dwFlags specifies MOVEFILE_DELAY_UNTIL_REBOOT, the file cannot exist on a remote share because delayed operations are performed before the network is available.
In the ANSI version of this function, the name is limited to MAX_PATH characters. To extend this limit to 32,767 wide characters, call the Unicode version of the function and prepend "\\\\?\\" to the path. For more information, see Naming a File .
lpNewFileName [in, optional]
The new name of the file or directory on the local computer.
When moving a file, lpNewFileName can be on a different file system or volume. If lpNewFileName is on another drive, you must set the MOVEFILE_COPY_ALLOWED flag in dwFlags.
When moving a directory, lpExistingFileName and lpNewFileName must be on the same drive.
If dwFlags specifies MOVEFILE_DELAY_UNTIL_REBOOT and lpNewFileName is NULL, MoveFileWithProgress registers lpExistingFileName to be deleted when the system restarts. The function fails if it cannot access the registry to store the information about the delete operation. If lpExistingFileName refers to a directory, the system removes the directory at restart only if the directory is empty.
lpProgressRoutine [in, optional]
A pointer to a CopyProgressRoutine callback function that is called each time another portion of the file has been moved. The callback function can be useful if you provide a user interface that displays the progress of the operation. This parameter can be NULL.
lpData [in, optional]
An argument to be passed to the CopyProgressRoutine callback function. This parameter can be NULL.
dwFlags [in]
The move options. This parameter can be one or more of the following values.
ValueMeaning
MOVEFILE_COPY_ALLOWED
2 (0x2)If the file is to be moved to a different volume, the function simulates the move by using the CopyFile and DeleteFile functions.
This value cannot be used with MOVEFILE_DELAY_UNTIL_REBOOT.
MOVEFILE_CREATE_HARDLINK
16 (0x10)Reserved for future use.
MOVEFILE_DELAY_UNTIL_REBOOT
4 (0x4)The system does not move the file until the operating system is restarted. The system moves the file immediately after AUTOCHK is executed, but before creating any paging files. Consequently, this parameter enables the function to delete paging files from previous startups.
This value can only be used if the process is in the context of a user who belongs to the administrators group or the LocalSystem account.
This value cannot be used with MOVEFILE_COPY_ALLOWED.
MOVEFILE_FAIL_IF_NOT_TRACKABLE
32 (0x20)The function fails if the source file is a link source, but the file cannot be tracked after the move. This situation can occur if the destination is a volume formatted with the FAT file system.
MOVEFILE_REPLACE_EXISTING
1 (0x1)If a file named lpNewFileName exists, the function replaces its contents with the contents of the lpExistingFileName file.
This value cannot be used if lpNewFileName or lpExistingFileName names a directory.
MOVEFILE_WRITE_THROUGH
8 (0x8)The function does not return until the file has actually been moved on the disk.
Setting this value guarantees that a move performed as a copy and delete operation is flushed to disk before the function returns. The flush occurs at the end of the copy operation.
This value has no effect if MOVEFILE_DELAY_UNTIL_REBOOT is set.

Return Value
If the function succeeds, the return value is nonzero.
If the function fails, the return value is zero. To get extended error information, call GetLastError .
When moving a file across volumes, if lpProgressRoutine returns PROGRESS_CANCEL due to the user canceling the operation, MoveFileWithProgress will return zero and GetLastError will return ERROR_REQUEST_ABORTED. The existing file is left intact.
When moving a file across volumes, if lpProgressRoutine returns PROGRESS_STOP due to the user stopping the operation, MoveFileWithProgress will return zero and GetLastError will return ERROR_REQUEST_ABORTED. The existing file is left intact.
Remarks
The MoveFileWithProgress function coordinates its operation with the link tracking service, so link sources can be tracked as they are moved.
To delete or rename a file, you must have either delete permission on the file or delete child permission in the parent directory. If you set up a directory with all access except delete and delete child and the ACLs of new files are inherited, then you should be able to create a file without being able to delete it. However, you can then create a file, and you will get all the access you request on the handle returned to you at the time you create the file. If you requested delete permission at the time you created the file, you could delete or rename the file with that handle but not with any other.
To compile an application that uses this function, define the _WIN32_WINNT macro as 0x0500 or later. For more information, see Using the Windows Headers .
Requirements
Minimum supported clientWindows 2000 Professional
Minimum supported serverWindows 2000 Server
HeaderWinBase.h (include Windows.h)
LibraryKernel32.lib
DLLKernel32.dll
Unicode and ANSI namesMoveFileWithProgressW (Unicode) and MoveFileWithProgressA (ANSI)
See Also
CopyFileEx
CopyProgressRoutine
File Management Functions
MoveFileEx
MoveFileTransacted
Send comments about this topic to Microsoft
Build date: 9/3/2009
==原始网址==http://msdn.microsoft.com/en-us/library/aa365242(VS.85).aspx\n
随便看

 

windows api函数参考手册包含2258条windows api函数文档,详细介绍nodejs、java、rust调用windows api的方法技巧,是学习windows api编程的入门中文文档。

 

Copyright © 2004-2023 Winrtm.com All Rights Reserved
京ICP备2021023879号-40 更新时间:2024/10/6 9:25:40