网站首页  词典首页

请输入您要查询的函数:

 

术语 setfiletime
释义 SetFileTime
语法:
C++
BOOL WINAPI SetFileTime(
__in HANDLE hFile,
__in_opt const FILETIME *lpCreationTime,
__in_opt const FILETIME *lpLastAccessTime,
__in_opt const FILETIME *lpLastWriteTime
);
SetFileTime函数
设置日期和时间,到指定的文件或目录的创建,最后一次访问,或最后修改。
参数
hFile [in]
句柄的文件或目录。句柄必须已创建使用与FILE_WRITE_ATTRIBUTES查阅的权利,CreateFile函数。有关更多信息,请参阅文件安全性和访问权限。
lpCreationTime [中,可选]
一个FILETIME结构,它包含了新的创建日期和时间,文件或目录的指针。此参数可以是NULL如果应用程序不需要更改此信息。
lpLastAccessTime [中,可选]
一个FILETIME结构,它包含了新的上次访问的日期和时间,文件或目录的指针。最后访问时间,包括上一次的文件或目录的写入,读取,或(在可执行文件的情况下)运行。此参数可以是NULL如果应用程序不需要更改此信息。
为了保持甚至在访问一个文件一个文件的现有上次访问时间,请打开文件后,处理此参数的FILETIME结构成员SetFileTime立即初始化到0xFFFFFFFF。
lpLastWriteTime [中,可选]
一个FILETIME结构,它包含了新的最后修改日期和文件或目录时间的指针。此参数可以是NULL如果应用程序不需要更改此信息。
返回值
如果函数成功,返回值为非零。
如果函数失败,返回值是零。为了获得更多错误信息,调用GetLastError。
备注
不是所有的文件系统可以记录创建和最后访问时间,并非所有文件系统记录他们以同样的方式。例如,在FAT,创建时间为10毫秒的决议,写入时间有2秒的决议,存取时间有一天决议(真的,访问日期)。因此,GetFileTime函数可能不返回相同的文件时间信息设置使用SetFileTime。 NTFS的延迟更新的文件的最后访问时间最多一小时后,最后访问。
实例
有关示例,请参阅更改一个文件时间为当前时间。
要求:
最低支持:client-Windows 2000专业版
最低支持server-Windows 2000服务器
HeaderWinbase.h(头文件:winuser.h)
LibraryKernel32.lib
DLLKernel32.dll
参见
文件时报
FILETIME
GetFileSize
GetFileTime
GetFileType
SetFileInformationByHandle
时间函数
如果有任何问题和意见,请发送给微软(wsddocfb@microsoft.com)
生成日期:2009年8月27日
==英文原文==SetFileTime Function
Sets the date and time that the specified file or directory was created, last accessed, or last modified.
Syntax
C++
BOOL WINAPI SetFileTime(
__in HANDLE hFile,
__in_opt const FILETIME *lpCreationTime,
__in_opt const FILETIME *lpLastAccessTime,
__in_opt const FILETIME *lpLastWriteTime
);
Parameters
hFile [in]
A handle to the file or directory. The handle must have been created using the CreateFile function with the FILE_WRITE_ATTRIBUTES access right. For more information, see File Security and Access Rights .
lpCreationTime [in, optional]
A pointer to a FILETIME structure that contains the new creation date and time for the file or directory. This parameter can be NULL if the application does not need to change this information.
lpLastAccessTime [in, optional]
A pointer to a FILETIME structure that contains the new last access date and time for the file or directory. The last access time includes the last time the file or directory was written to, read from, or (in the case of executable files) run. This parameter can be NULL if the application does not need to change this information.
To preserve the existing last access time for a file even after accessing a file, call SetFileTime immediately after opening the file handle with this parameter's FILETIME structure members initialized to 0xFFFFFFFF.
lpLastWriteTime [in, optional]
A pointer to a FILETIME structure that contains the new last modified date and time for the file or directory. This parameter can be NULL if the application does not need to change this information.
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 .
Remarks
Not all file systems can record creation and last access times and not all file systems record them in the same manner. For example, on FAT, create time has a resolution of 10 milliseconds, write time has a resolution of 2 seconds, and access time has a resolution of 1 day (really, the access date). Therefore, the GetFileTime function may not return the same file time information set using SetFileTime. NTFS delays updates to the last access time for a file by up to one hour after the last access.
Examples
For an example, see Changing a File Time to the Current Time .
Requirements
Minimum supported clientWindows 2000 Professional
Minimum supported serverWindows 2000 Server
HeaderWinbase.h (include Windows.h)
LibraryKernel32.lib
DLLKernel32.dll
See Also
File Times
FILETIME
GetFileSize
GetFileTime
GetFileType
SetFileInformationByHandle
Time Functions
Send comments about this topic to Microsoft
Build date: 8/27/2009
==原始网址==http://msdn.microsoft.com/en-us/library/ms724933(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 13:21:10