顯卡:
創(chuàng)新互聯(lián)是一家集網(wǎng)站建設,劍川企業(yè)網(wǎng)站建設,劍川品牌網(wǎng)站建設,網(wǎng)站定制,劍川網(wǎng)站建設報價,網(wǎng)絡營銷,網(wǎng)絡優(yōu)化,劍川網(wǎng)站推廣為一體的創(chuàng)新建站企業(yè),幫助傳統(tǒng)企業(yè)提升企業(yè)形象加強企業(yè)競爭力??沙浞譂M足這一群體相比中小企業(yè)更為豐富、高端、多元的互聯(lián)網(wǎng)需求。同時我們時刻保持專業(yè)、時尚、前沿,時刻以成就客戶成長自我,堅持不斷學習、思考、沉淀、凈化自己,讓我們?yōu)楦嗟钠髽I(yè)打造出實用型網(wǎng)站。
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
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 _
"文件系統(tǒng):" 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
strResult += 磁盤類型: System.Convert.ToInt16(disk(DriveType).ToString())End IfMsgBox(strResult)NextEnd Sub總結:在VB.NET中,用API函數(shù)可以獲取硬盤信息。原來熟悉API函數(shù)VB6程序員,可以對API函數(shù)聲明進行適當?shù)母暮?,進行調用。利用FSO(文件系統(tǒng)對象)的Scrrun.DLL,也可以獲得磁盤信息。在.net Framwork中,利用WMI可以獲取更多的關于機器硬件的詳細信息(參考System.Management命名空間)。
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 "狀態(tài): " item.Status vbCrLf
s = s "類型: " item.SystemType vbCrLf
s = s "生產(chǎn)廠家: " 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 "啟動狀態(tài)" item.BootupState vbCrLf
s = s "該計算機屬于" item.PrimaryOwnerName vbCrLf
s = s "系統(tǒng)類型" item.CreationClassName vbCrLf
s = s "計算機類類型" item.Description vbCrLf
For i = 0 To 1 ‘這里假設安裝了兩個系統(tǒng)
s = s Chr(5) "啟動選項" i " :" item.SystemStartupOptions(i) _
vbCrLf
Next i
Next
Text1.Text = s
運行上面的代碼后,在textBox中就可以顯示計算機的信息。
在上面的代碼中,程序通過GetObject("winmgmts:")獲得WMI對象,然后獲得下面的
Win32_ComputerSystem子項并通過訪問Win32_ComputerSystem對象中的分項獲得系統(tǒng)中的信息。
*需要說明的是,并不是所有的系統(tǒng)都支持WMI,在有些系統(tǒng)中無法顯示生產(chǎn)廠家等信息。
先引用system.io
之后聲明類型為 DriveInfo 的變量
聲明的對象中包含 一些方法