扫一扫
分享文章到微信
扫一扫
关注官方公众号
至顶头条
作者:潇潇 来源:YESKY 2007年10月14日
关键字:
Declare Function lopen Lib "kernel32" Alias "_lopen" (ByVal lpPathName As String, ByVal iReadWrite As Long) As Long |
参数 | 类型及说明 | |
lpPathName | String,欲打开文件的名字 | |
iReadWrite | Long,访问模式和共享模式常数的一个组合,如下所示: | |
1、访问模式 | ||
READ | 打开文件,读取其中的内容 | |
READ_WRITE | 打开文件,对其进行读写 | |
WRITE | 打开文件,在其中写入内容 | |
2、共享模式(参考OpenFile函数的标志常数表) | ||
OF_SHARE_COMPAT, OF_SHARE_DENY_NONE, OF_SHARE_DENY_READ, OF_SHARE_DENY_WRITE, OF_SHARE_EXCLUSIVE |
Declare Function GetFileTime Lib "kernel32" Alias "GetFileTime" (ByVal hFile As Long, lpCreationTime As FILETIME, lpLastAccessTime As FILETIME, lpLastWriteTime As FILETIME) As Long |
参数 | 类型及说明 |
hFile | Long,文件的句柄 |
lpCreationTime | FILETIME,用于装载文件的创建时间 |
lpLastAccessTime | FILETIME,用于装载文件上一次访问的时间(FAT文件系统不支持这一特性) |
lpLastWriteTime | FILETIME,用于装载文件上一次修改的时间 |
‘函数声明 Private Declare Function GetFileTime Lib "kernel32" (ByVal hFile As Long, lpCreationTime As FileTime, lpLastAccessTime As FileTime, lpLastWriteTime As FileTime) As Long Private Declare Function lopen Lib "kernel32" Alias "_lopen" (ByVal lpPathName As String, ByVal iReadWrite As Long) As Long ‘定义变量 Dim file As Long Dim CreationTime As FileTime Dim lastaccesstime As FileTime Dim lastaccesstime As FileTime ‘定义结构 Private Type FileTime dwLowDateTime As Long dwHighDateTime As Long End Type Private Sub Form_Load() str1 = "c:\text.txt" file = lopen(str1, READ_WRITE) ‘打开文件 temp = GetFileTime(file, CreationTime, lastaccesstime, lastwritetime)’得到文件相关信息 MsgBox CreationTime ‘显示信息 End Sub |
Declare Function CopyFile Lib "kernel32" Alias "CopyFileA" (ByVal lpExistingFileName As String, ByVal lpNewFileName As String, ByVal bFailIfExists As Long) As Long |
参数 | 类型及说明 |
lpExistingFileName | String,源文件名 |
lpNewFileName | String,目标文件名 |
bFailIfExists | Long,如果设为TRUE(非零),那么一旦目标文件已经存在,则函数调用会失败。否则目标文件被改写 |
‘函数声明 Private Declare Function CopyFile Lib "kernel32" Alias "CopyFileA" (ByVal lpExistingFileName As String, ByVal lpNewFileName As String, ByVal bFailIfExists As Long) As Long Private Sub Form_Load() CopyFile "c:\test1.txt", "c:\test2.txt", 1 End Sub |
如果您非常迫切的想了解IT领域最新产品与技术信息,那么订阅至顶网技术邮件将是您的最佳途径之一。
现场直击|2021世界人工智能大会
直击5G创新地带,就在2021MWC上海
5G已至 转型当时——服务提供商如何把握转型的绝佳时机
寻找自己的Flag
华为开发者大会2020(Cloud)- 科技行者