【问题标题】:Reading the serial number of USB storage device in Vb在Vb中读取USB存储设备的序列号
【发布时间】:2013-01-19 22:26:02
【问题描述】:

是否可以使用VB读取USB驱动器的序列号。

【问题讨论】:

    标签: vb.net usb


    【解决方案1】:

    这将为您提供 .net 中驱动器的信息,包括 USB 设备 只需导入这些

    导入脚本 导入 System.IO

    Private Class USBsn
        Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
           Dim driveNames As New List(Of String)
           For Each drive As DriveInfo In My.Computer.FileSystem.Drives
              Try
                Dim fso As Scripting.FileSystemObject
                Dim oDrive As Drive
    
                fso = CreateObject("Scripting.FileSystemObject")
    
                oDrive = fso.GetDrive(drive.Name)
    
                ListBox1.Items.Add(drive.Name & "   " & oDrive.SerialNumber)
            Catch ex As Exception
            End Try
    
            Next
        End Sub
    End Class
    

    【讨论】:

      【解决方案2】:

      Google 找到了这些教程:

      visual basic(适用于硬盘串行,但似乎也适用于 USB 驱动器):

      http://www.codeproject.com/KB/cs/hard_disk_serialno.aspx

      powershell 和 vbasic:

      http://blogs.msdn.com/powershell/archive/2007/02/24/displaying-usb-devices-using-wmi.aspx

      vbasic:

      http://www.myitforum.com/forums/m_147418/mpage_1/key_/tm.htm

      【讨论】:

        【解决方案3】:

        它在注册表中,HKLM\System\CCS\Enum\USB\VID_XXXX&PID_YYYY\<serial>。 (供应商和产品 ID 也会有所不同,因为序列号仅对单个产品是唯一的。)

        【讨论】:

          猜你喜欢
          • 1970-01-01
          • 2018-08-13
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 2023-03-06
          • 2021-03-02
          • 2022-09-30
          相关资源
          最近更新 更多