资讯

精准传达 • 有效沟通

从品牌网站建设到网络营销策划,从策略到执行的一站式服务

vb.net获取硬件数据 vb读取电脑硬件信息

求人!!!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获取硬件信息的代码

tmpstr=""

set fso=createObject("scripting.filesystemObject")

Set dc = fso.Drives

for each d in dc

If d.isReady Then

tmpstr=tmpstr "磁盘" d.DriveLetter ":" vbcrlf _

"可用空间:" (d.AvailableSpace/1024/1024/1024) " GB" vbcrlf _

"空余空间:" (d.FreeSpace/1024/1024/1024) " GB"  vbcrlf _

"总空间大小:" (d.TotalSize/1024/1024/1024) " GB"  vbcrlf _

"文件系统:" d.FileSystem vbcrlf _

"驱动器类型:" d.DriveType vbcrlf _

"是否就绪:" d.IsReady vbcrlf _

"路径:" d.Path vbcrlf _

"根目录:" d.RootFolder vbcrlf _

"序列号:" d.SerialNumber vbcrlf _

"共享名:" d.ShareName vbcrlf _

"卷名:" d.VolumeName vbcrlf vbcrlf

End If

Next

msgbox tmpstr

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命名空间)。

请教,如何用VB获取计算机硬件信息

VB可以使用Windows管理设备(WMI)进行读取计算机硬件信息。

Dim s, System, item

Dim i As Integer

Set System = GetObject("winmgmts:").InstancesOf("Win32_ComputerSystem")

For Each item In System

‘List1.AddItem item.cputype

s = "Computer Info" vbCrLf

s = s "***********************" vbCrLf

s = s "计算机名称: " item.name vbCrLf

s = s "状态: " item.Status vbCrLf

s = s "类型: " item.SystemType vbCrLf

s = s "生产厂家: " item.Manufacturer vbCrLf

s = s "型号: " item.Model vbCrLf

s = s "内存: ~" item.totalPhysicalMemory \ 1024000 "mb" vbCrLf

s = s "域: " item.domain vbCrLf

‘s = s "工作组" item.Workgroup vbCrLf ‘获得工作组和域的选项不能同时用

s = s "当前用户: " item.username vbCrLf

s = s "启动状态" item.BootupState vbCrLf

s = s "该计算机属于" item.PrimaryOwnerName vbCrLf

s = s "系统类型" item.CreationClassName vbCrLf

s = s "计算机类类型" item.Description vbCrLf

For i = 0 To 1 ‘这里假设安装了两个系统

s = s Chr(5) "启动选项" i " :" item.SystemStartupOptions(i) _

vbCrLf

Next i

Next

Text1.Text = s

运行上面的代码后,在textBox中就可以显示计算机的信息。

在上面的代码中,程序通过GetObject("winmgmts:")获得WMI对象,然后获得下面的

Win32_ComputerSystem子项并通过访问Win32_ComputerSystem对象中的分项获得系统中的信息。

*需要说明的是,并不是所有的系统都支持WMI,在有些系统中无法显示生产厂家等信息。

VB.Net如何查看计算机硬件的详细属性(如:查看U盘的位置)?

先引用system.io

之后声明类型为 DriveInfo 的变量

声明的对象中包含 一些方法


本文标题:vb.net获取硬件数据 vb读取电脑硬件信息
文章链接:http://www.cdkjz.cn/article/dodejis.html
多年建站经验

多一份参考,总有益处

联系快上网,免费获得专属《策划方案》及报价

咨询相关问题或预约面谈,可以通过以下方式与我们联系

大客户专线   成都:13518219792   座机:028-86922220