VB 读硬盘序列号
求VB读硬盘序列号方法如点按钮cmmand1后将获取的序列号在Label1里显示.请给出例子,谢谢...
求VB 读硬盘序列号方法
如点按钮 cmmand1 后 将获取的序列号在 Label1 里显示.
请给出例子,谢谢 展开
如点按钮 cmmand1 后 将获取的序列号在 Label1 里显示.
请给出例子,谢谢 展开
2个回答
展开全部
我用16进制显示,有个性
Private Declare Function 获得硬盘序列号 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 Sub Form_Load()
On Error GoTo Err_Form_Load
Dim AA, 硬盘序列号, Maxlen, Sysflag As Long: Dim VolName, FsysName As String
AA = 获得硬盘序列号("c:\", VolName, 256, 硬盘序列号, Maxlen, Sysflag, FsysName, 256)
Form1.Caption = "C硬盘序列号(16制): " & Hex(硬盘序列号)
Exit Sub
Err_Form_Load:
End Sub
Private Declare Function 获得硬盘序列号 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 Sub Form_Load()
On Error GoTo Err_Form_Load
Dim AA, 硬盘序列号, Maxlen, Sysflag As Long: Dim VolName, FsysName As String
AA = 获得硬盘序列号("c:\", VolName, 256, 硬盘序列号, Maxlen, Sysflag, FsysName, 256)
Form1.Caption = "C硬盘序列号(16制): " & Hex(硬盘序列号)
Exit Sub
Err_Form_Load:
End Sub
展开全部
VolName = String(255, 0)
fsysName = String(255, 0)
aa = GetVolumeInformation(Path, VolName, 256, VolSeri, Maxlen, Sysflag, fsysName, 256)
VolName = Left(VolName, InStr(1, VolName, Chr(0)) - 1)
fsysName = Left(fsysName, InStr(1, fsysName, Chr(0)) - 1)
compress = Sysflag And FILE_VOLUME_IS_COMPRESSED
以前给硬盘加密的时候写的,主要精髓就在这儿了
fsysName = String(255, 0)
aa = GetVolumeInformation(Path, VolName, 256, VolSeri, Maxlen, Sysflag, fsysName, 256)
VolName = Left(VolName, InStr(1, VolName, Chr(0)) - 1)
fsysName = Left(fsysName, InStr(1, fsysName, Chr(0)) - 1)
compress = Sysflag And FILE_VOLUME_IS_COMPRESSED
以前给硬盘加密的时候写的,主要精髓就在这儿了
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询