玩酷之家

 找回密码
 立即注册
查看: 1867|回复: 1

获取超过4GB的大文件大小

[复制链接]

98

主题

103

帖子

426

积分

中级会员

Rank: 3Rank: 3

积分
426
发表于 2019-3-7 21:14:38 | 显示全部楼层 |阅读模式

  1. Option Explicit
  2. Const GENERIC_READ = &H80000000
  3. Const FILE_SHARE_READ = &H1
  4. Const OPEN_EXISTING = 3
  5. Const FILE_TYPE_CHAR = &H2
  6. Const FILE_TYPE_DISK = &H1
  7. Const FILE_TYPE_PIPE = &H3
  8. Const FILE_TYPE_UNKNOWN = &H0
  9. Private Declare Function GetFileType Lib "kernel32" (ByVal hFile As Long) As Long
  10. Private Declare Function CreateFile Lib "kernel32" Alias "CreateFileA" (ByVal lpFileName As String, ByVal dwDesiredAccess As Long, ByVal dwShareMode As Long, lpSecurityAttributes As Any, ByVal dwCreationDisposition As Long, ByVal dwFlagsAndAttributes As Long, ByVal hTemplateFile As Long) As Long
  11. Private Declare Function GetFileSizeEx Lib "kernel32" (ByVal hFile As Long, lpFileSize As Currency) As Boolean
  12. Private Declare Function CloseHandle Lib "kernel32" (ByVal hObject As Long) As Long
  13. Private Sub Form_load()
  14. Debug.Print GetBigSize("E:\系统\ISO\cn_windows_10_business_edition_version_1809.iso")
  15. End Sub

  16. Public Function GetBigSize(ByVal PathName As String) As Currency
  17.     Dim hFile As Long, nSize As Currency
  18.     hFile = CreateFile(PathName, GENERIC_READ, FILE_SHARE_READ, ByVal 0&, OPEN_EXISTING, ByVal 0&, ByVal 0&)
  19.     GetFileSizeEx hFile, nSize
  20.     CloseHandle hFile
  21.     GetBigSize = nSize * 10000
  22. End Function

复制代码


最多选择要压缩的20张 PNG图像
回复

使用道具 举报

4

主题

20

帖子

157

积分

注册会员

Rank: 2

积分
157
QQ
发表于 2019-3-8 11:48:14 | 显示全部楼层
收藏收藏嗷呜。
细嗅蔷薇。
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

QQ|Archiver|手机版|小黑屋|玩酷之家 ( 鄂ICP备14012049号-1 )|

GMT+8, 2020-8-4 17:13 , Processed in 1.092002 second(s), 19 queries .

Powered by Discuz! X3.4

Copyright © 2001-2020, Tencent Cloud.

快速回复 返回顶部 返回列表