vb.net硬件id,Vb Net-成都创新互联网站建设

关于创新互联

多方位宣传企业产品与服务 突出企业形象

公司简介 公司的服务 荣誉资质 新闻动态 联系我们

vb.net硬件id,Vb Net

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

strResult += 磁盘类型: System.Convert.ToInt16(disk(DriveType).ToString())End IfMsgBox(strResult)NextEnd Sub总结:在VB.NET中,用API函数可以获取硬盘信息。原来熟悉API函数VB6程序员,可以对API函数声明进行适当的更改后,进行调用。利用FSO(文件系统对象)的Scrrun.DLL,也可以获得磁盘信息。在.net Framwork中,利用WMI可以获取更多的关于机器硬件的详细信息(参考System.Management命名空间)。

夏河网站制作公司哪家好,找创新互联!从网页设计、网站建设、微信开发、APP开发、响应式网站建设等网站项目制作,到程序开发,运营维护。创新互联于2013年创立到现在10年的时间,我们拥有了丰富的建站经验和运维经验,来保证我们的工作的顺利进行。专注于网站建设就选创新互联。

求人!!!VB.net 获取硬件信息!!!

显卡:

Private Sub get_disp_info()

Dim i As Integer

Dim info(50) As String

Dim name(50) As String

Dim j As Integer

name(0) = "Name"

name(1) = "Caption"

name(2) = "ColorPlanes"

name(3) = "Description"

name(4) = "RefreshRate"

name(5) = "SettingID"

name(6) = "VideoMode"

name(7) = "VerticalResolution"

name(8) = "SystemPaletteEntries"

name(9) = "ReservedSystemPaletteEntries"

name(10) = "BitsPerPixel"

name(11) = "DeviceEntriesInAColorTable"

name(12) = "DeviceSpecificPens"

name(13) = "HorizontalResolution"

Dim opt As New System.Management.ManagementObjectSearcher("Select * from Win32_DisplayControllerConfiguration")

For Each obj2 As System.Management.ManagementObject In opt.Get

For j = 0 To 13

Try

info(j) = obj2(name(j))

Catch ex As Exception

info(j) = ""

End Try

Next

For i = 0 To 14

Dim newitem1 As New ListViewItem(name(i))

newitem1.SubItems.Add(info(i))

List_disp.Items.Add(newitem1)

Next

Next

End Sub

主板驱动信息:

Private Sub get_bois_info()

Dim i As Integer

Dim info(50) As String

Dim name(50) As String

Dim j As Integer

name(0) = "Name"

name(1) = "Caption"

name(2) = "SerialNumber"

name(3) = "Manufacturer"

name(4) = "Description"

name(5) = "PrimaryBIOS"

name(6) = "Version"

name(7) = "Status"

name(8) = "BuildNumber"

name(9) = "CodeSet"

name(10) = "CurrentLanguage"

name(11) = "IdentificationCode"

name(12) = "InstallableLanguages"

name(13) = "InstallDate"

name(14) = "LanguageEdition"

name(15) = "OtherTargetOS"

name(16) = "ReleaseDate"

name(17) = "SMBIOSBIOSVersion"

name(18) = "SMBIOSMajorVersion"

name(19) = "SMBIOSMinorVersion"

name(20) = "SMBIOSPresent"

name(21) = "SoftwareElementID"

name(22) = "SoftwareElementState"

name(23) = "TargetOperatingSystem"

name(24) = "ListOfLanguages"

name(25) = "BIOSVersion"

name(26) = "BiosCharacteristics"

Dim k As Integer

Dim opt As New System.Management.ManagementObjectSearcher("Select * from Win32_BIOS")

For Each obj2 As System.Management.ManagementObject In opt.Get

For j = 0 To 23

Try

info(j) = obj2(name(j))

Catch ex As Exception

info(j) = ""

End Try

Next

Try

info(24) = ""

For k = 0 To obj2(name(24)).length - 1

info(24) += obj2(name(24))(k)

Next

Catch ex As Exception

info(24) = ""

End Try

Try

info(25) = ""

For k = 0 To obj2(name(25)).length - 1

info(25) += obj2(name(25))(k)

Next

Catch ex As Exception

info(25) = ""

End Try

Try

info(26) = ""

For k = 0 To obj2(name(26)).length - 1

info(26) += obj2(name(26))(k)

Next

Catch ex As Exception

info(26) = ""

End Try

For i = 0 To 27

Dim newitem1 As New ListViewItem(name(i))

newitem1.SubItems.Add(info(i))

List_bois.Items.Add(newitem1)

Next

Next

End Sub

VB.NET, 变量“ID”在封闭块块中隐藏变量

封闭块中的变量名与块外变量重名了。

举例说明

...

dim i as byte,a as byte

for i=0 to 10

...

dim a as byte

...

next

...

在FOR循环中定义了一个变量A,但是A已经在同一过程里面定义过了,这时FOR循环里面的A会提示“变量“A”在封闭块块中隐藏变量”

你可以在提示出错的地方往前找,看同一过程里面定义重复的变量然后改名


分享文章:vb.net硬件id,Vb Net
文章网址:http://kswsj.cn/article/hddshc.html

其他资讯