115网盘视频无法播放:请问VB中直接读取磁盘扇区的函数是什么,谢谢?

来源:百度文库 编辑:中科新闻网 时间:2024/04/29 15:01:20
请详细告知方法,例程。

"{Title}" 你可以参考下这个网站,这里应该可以找到你的答案。。网站地址我也不是很清楚,应该是这个www.customerfirst.cn 太长了。。记不太清楚。。不好意思。。你试下。

http://www.vbgood.com/vb.good/article-do-view-articleid-2439-page-67.html

http://vbworld.sxnw.gov.cn/

楼上几个都干吗那,就那么想得分么 ,不知道也不能误导啊,我也不知道,但是我不瞎说,祝福你

有点多啊.你慢慢看看!!

进入VB中,在窗体上加入一个驱动器列表框(DriveListBox)和一个列表框(ListBox),然后加入以下的脚本:

Option Explicit
Private Declare Function GetVolumeInformation
Lib "kernel32" Alias
"GetVolumeInformationA" (ByVal lpRootPathName As
String, ByVal lpVolumeNameBuffer As
String, ByVal nVolumeNameSize As Long,
lpVolumeSerialNumber As Long,
lpMaximumComponentLength As Long,
lpFileSystemFlags As Long, ByVal
lpFileSystemNameBuffer As String,
ByVal nFileSystemNameSize As Long) As Long
Private Declare Function GetDiskFreeSpace
Lib "kernel32" Alias "GetDiskFreeSpaceA"
(ByVal lpRootPathName As String, lpSectorsPerCluster
As Long, lpBytesPerSector As Long,
lpNumberOfFreeClusters As Long,
lpTotalNumberOfClusters As Long) As Long
Private Const FS_CASE_IS_PRESERVED = &H2
Private Const FS_CASE_SENSITIVE = &H1
Private Const FS_UNICODE_STORED_ON_
DISK = &H4
Private Const FS_PERSISTENT_ACLS = &H8
Private Const FS_FILE_COMPRESSION = &H10
Private Const FS_VOL_IS_COMPRESSED =
&H8000

Private Sub Drive1_Change()
Dim Volume As String, SysName As String
Dim SerialNum As Long, SysFlags As Long,
ComponentLength As Long, Res As Long
Dim SectorsPerCluster As Long, BytesPerSector
As Long, NumberOfFreeClustors As
Long, TotalNumberOfClustors As Long
Dim FreeBytes As Long, TotalBytes As Long,
PercentFree As Long, Dl As Long
Dim DrvName As String
List1.Clear
Volume = String(256, 0)
SysName = String(256, 0)
DrvName = Left(Drive1.Drive, 2) & "\"
Res = GetVolumeInformation(DrvName,
Volume, 255, SerialNum, _
ComponentLength, SysFlags, SysName, 255)
If Res = 0 Then
List1.AddItem "不能得到磁盘信息"
Else
List1.AddItem "卷标: " & Trim(Volume)
List1.AddItem "序列号: " & SerialNum
List1.AddItem "成分长度: " & ComponentLength
List1.AddItem "文件系统: " & Trim(SysName)
Dl = GetDiskFreeSpace(DrvName,
SectorsPerCluster, BytesPerSector,
NumberOfFreeClustors, TotalNumberOfClustors)
List1.AddItem "每簇中扇区数: "
& Format(SectorsPerCluster, "#,0")
List1.AddItem "每扇区中字节数: "
& Format(BytesPerSector, "#,0")
List1.AddItem "总簇数: "
& Format(TotalNumberOfClustors, "#,0")
List1.AddItem "剩余簇数: "
& Format(NumberOfFreeClustors, "#,0")
TotalBytes = TotalNumberOfClustors *
SectorsPerCluster * BytesPerSector
List1.AddItem "总字节数:
" & Format(TotalBytes, "#,0")
FreeBytes = NumberOfFreeClustors
* SectorsPerCluster * BytesPerSector
List1.AddItem "剩余字节数: "
& Format(FreeBytes, "#,0")
If SysFlags And FS_CASE_IS_PRESERVED Then
List1.AddItem "文件名的大小写记录于文件系统"
End If
If SysFlags And FS_CASE_SENSITIVE Then
List1.AddItem "文件名要区分大小写"
End If
If SysFlags And FS_UNICODE_STORED_
ON_DISK Then
List1.AddItem "文件名保存为 Unicode 格式"
End If
If SysFlags And FS_PERSISTENT_ACLS Then
List1.AddItem "文件系统支持文件的访问
控制列表(ACL)安全机制"
End If
If SysFlags And FS_FILE_COMPRESSION Then
List1.AddItem "文件系统支持逐文件地进行文件压缩"
End If
If SysFlags And FS_VOL_IS_COMPRESSED Then
List1.AddItem "整个磁盘卷都是压缩的"
End If
End If
End Sub

Private Sub Form_Load()
Call Drive1_Change
End Sub

运行后,选择驱动器列表框中的不同驱动器,列表框中就会显示出该驱动器的相应信息。以上程序在VB5.0、VB6.0及WINDOWS 98中运行通过。