成都网站建设设计

将想法与焦点和您一起共享

vb.net获取硬盘号,vb读取硬盘序列号

win7下vb.net 如何获取硬盘序列号

Private Function 硬盘序列号() As String

我们提供的服务有:网站建设、成都网站设计、微信公众号开发、网站优化、网站认证、景县ssl等。为1000多家企事业单位解决了网站和推广的问题。提供周到的售前咨询和贴心的售后服务,是有科学管理、有技术的景县网站制作公司

Try

Dim myInfo As Microsoft.Win32.RegistryKey = My.Computer.Registry.LocalMachine.OpenSubKey("HARDWARE\DEVICEMAP\Scsi\Scsi Port 0\Scsi Bus 1\Target Id 0\Logical Unit Id 0")

硬盘序列号 = Trim(myInfo.GetValue("SerialNumber"))

Catch

Try

Dim myInfo As Microsoft.Win32.RegistryKey = My.Computer.Registry.LocalMachine.OpenSubKey("HARDWARE\DEVICEMAP\Scsi\Scsi Port 1\Scsi Bus 1\Target Id 0\Logical Unit Id 0")

硬盘序列号 = Trim(myInfo.GetValue("SerialNumber"))

Catch

硬盘序列号 = ""

End Try

End Try

End Function

试下,如果返回为空,则表示失败。

在本机win8win8.1有效,不过好像在有些机器上没用。

vb.net如何获取电脑中的所有盘符

首先使用 System.IO.DriveInfo.GetDrives()获取System.IO.DriveInfo,存入ds()

然后遍历ds,获取各个信息部分。

Dim ds() As System.IO.DriveInfo = System.IO.DriveInfo.GetDrives()

For i As Integer = 0 To ds.Length - 1

TextBox1.Text = TextBox1.Text + ds(i).DriveType.ToString + " " '驱动器类型

TextBox1.Text = TextBox1.Text + ds(i).Name + " " '盘符(驱动器名)

TextBox1.Text = TextBox1.Text + ds(i).IsReady.ToString + " " '是否就绪

If ds(i).IsReady = True Then

TextBox1.Text = TextBox1.Text + ds(i).VolumeLabel + " " '卷标

TextBox1.Text = TextBox1.Text + ds(i).TotalSize.ToString + " " '驱动器容量

TextBox1.Text = TextBox1.Text + ds(i).TotalFreeSpace.ToString '驱动器可用容量

End If

TextBox1.Text = TextBox1.Text + vbNewLine

Next

VS2010中怎么获取cpu或者硬盘序列号。用vb.net。想编一个注册码的软件

Private Function 硬盘序列号() As String

Try

Dim myInfo As Microsoft.Win32.RegistryKey = My.Computer.Registry.LocalMachine.OpenSubKey("HARDWARE\DEVICEMAP\Scsi\Scsi Port 0\Scsi Bus 1\Target Id 0\Logical Unit Id 0")

硬盘序列号 = Trim(myInfo.GetValue("SerialNumber"))

Catch

Try

Dim myInfo As Microsoft.Win32.RegistryKey = My.Computer.Registry.LocalMachine.OpenSubKey("HARDWARE\DEVICEMAP\Scsi\Scsi Port 1\Scsi Bus 1\Target Id 0\Logical Unit Id 0")

硬盘序列号 = Trim(myInfo.GetValue("SerialNumber"))

Catch

硬盘序列号 = ""

End Try

End Try

End Function

只在我的电脑上试过,你试下

VB.NET获取硬盘信息的几种方法

总结:在VB.NET中,用API函数可以获取硬盘信息。原来熟悉API函数VB6程序员,可以对API函数声明进行适当的更改后,进行调用。利用FSO(文件系统对象)的Scrrun.DLL,也可以获得磁盘信息。

VB如何获取机器码(硬盘码、主板码等)

'引用api获得硬盘序列号

Private Declare Function MymachineC 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()

Dim AA, 硬盘序列号, Maxlen, Sysflag As Long: Dim VolName, FsysName As String

AA = MymachineC("c:\", VolName, 256, 硬盘序列号, Maxlen, Sysflag, FsysName, 256)

msgbox "C硬盘序列号-机器码啦-(16制): " Hex(硬盘序列号)

End Sub

这样就搞定了

win64 下如何用VB获取硬盘参数,序列号?

private Declare Function MymachineC 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

dim ReturnValue As Long, HDSN, MaxLen As Long, SysFlag As Long, VolName As String, fSysName As String

private sub commadn1_click()

ReturnValue = MymachineC("C:\", VolName, 256, HDSN, MaxLen, SysFlag, fSysName, 256)

msgbox hdsn,,"硬盘序列号"

end sub


文章题目:vb.net获取硬盘号,vb读取硬盘序列号
当前地址:http://chengdu.cdxwcx.cn/article/hsodph.html