本文匯集了中得到計算機硬件信息的一些功能
得到顯示器分辨率
Dim X As Short = System
Dim Y As Short = System
MsgBox(
得到特殊文件夾的路徑
MsgBox(Environment
MsgBox(Environment
MsgBox(Environment
得到操作系統版本信息
MsgBox(Environment
得到當前登錄的用戶名
MsgBox(Environment
得到當前應用程序的路徑
MsgBox(Environment
打開和關閉CD
Module mciAPIModule
Declare Function mciSendString Lib
(ByVal lpstrCommand As String
ByVal uReturnLength As Integer
End Module
Dim lRet As Long
lRet = mciSendString(
Dim lRet As Long
lRet = mciSendString(
?url=/library/en
得到計算機IP和計算機全名
Dim MYIP As System
MsgBox(
MsgBox(
使用win
Dim opSearch As New ManagementObjectSearcher(
Dim opInfo As ManagementObject
For Each opInfo In opSearch
ListBox
ListBox
ListBox
ListBox
ListBox
Next
列出計算機安裝的全部字體
Private Sub Button
Dim fntCollection As InstalledFontCollection = New InstalledFontCollection()
Dim fntFamily() As FontFamily
fntFamily = fntCollection
ListBox
Dim i As Integer =
For i =
ListBox
Next
End Sub
使用Win
Imports System
Public Class Form
Inherits System
#Region
Public Sub New()
MyBase
InitializeComponent()
End Sub
Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
If disposing Then
If Not (components Is Nothing) Then
components
End If
End If
MyBase
End Sub
Private components As System
Friend WithEvents ListBox
Friend WithEvents Button
<System
Me
Me
Me
Me
Me
Me
Me
Me
Me
Me
Me
Me
Me
Me
Me
Me
Me
End Sub
#End Region
Private Sub Button
Handles Button
Dim ProcQuery As New SelectQuery(
Dim ProcSearch As New ManagementObjectSearcher(ProcQuery)
Dim ProcInfo As ManagementObject
For Each ProcInfo In ProcSearch
Call processorfamily(ProcInfo(
ListBox
ListBox
ListBox
Call processortype(ProcInfo(
Call CpuStat(ProcInfo(
ListBox
ListBox
ListBox
ListBox
ListBox
ListBox
ListBox
ListBox
Next
End Sub
Function processorfamily(ByVal procssfam)
Dim processtype
Select Case procssfam
Case
processtype =
Case
processtype =
Case
processtype =
Case
processtype =
Case
processtype =
Case
processtype =
Case
processtype =
Case
processtype =
Case
processtype =
Case
processtype =
Case
processtype =
Case
processtype =
Case
processtype =
Case
processtype =
Case
processtype =
Case
processtype =
Case
processtype =
Case
processtype =
Case
processtype =
Case
processtype =
Case
processtype =
Case
processtype =
Case
processtype =
Case
processtype =
Case
processtype =
Case
processtype =
Case
processtype =
Case
processtype =
Case
processtype =
Case
processtype =
Case
processtype =
Case
processtype =
Case
processtype =
Case
processtype =
Case
processtype =
Case
processtype =
Case
processtype =
Case
processtype =
Case
processtype =
Case
processtype =
Case
processtype =
Case
processtype =
Case
processtype =
Case
processtype =
Case
processtype =
Case
processtype =
Case
processtype =
Case
processtype =
Case
processtype =
Case
processtype =
Case
processtype =
Case
processtype =
Case
processtype =
Case
processtype =
Case
processtype =
Case
processtype =
Case
processtype =
Case
processtype =
Case
processtype =
Case
processtype =
Case
processtype =
Case
processtype =
Case
processtype =
Case
processtype =
Case
processtype =
Case
processtype =
Case
processtype =
Case
processtype =
Case
processtype =
Case
processtype =
Case
processtype =
Case
processtype =
Case
processtype =
Case
processtype =
Case
processtype =
Case
processtype =
Case
processtype =
Case
processtype =
Case
processtype =
Case
processtype =
Case
processtype =
Case
processtype =
Case
processtype =
Case
processtype =
Case
processtype =
Case
processtype =
Case
processtype =
Case
processtype =
Case
processtype =
Case
processtype =
Case
processtype =
Case
processtype =
Case
processtype =
Case
processtype =
Case
processtype =
Case
processtype =
Case
processtype =
Case
processtype =
Case
processtype =
Case
processtype =
Case
processtype =
Case
processtype =
Case
processtype =
End Select
ListBox
End Function
Function CpuStat(ByVal CpuStNUM)
Dim stat
Select Case CpuStNUM
Case
stat =
Case
stat =
Case
stat =
Case
stat =
Case
stat =
Case
stat =
Case
stat =
Case
stat =
End Select
ListBox
End Function
Function processortype(ByVal proctypenum)
Dim proctype
Select Case proctypenum
Case
proctype =
Case
proctype =
Case
proctype =
Case
proctype =
Case
proctype =
Case
proctype =
End Select
ListBox
End Function
End Class
得到CD
Imports System
Public Class Form
Inherits System
#Region
Public Sub New()
MyBase
InitializeComponent()
End Sub
Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
If disposing Then
If Not (components Is Nothing) Then
components
End If
End If
MyBase
End Sub
Private components As System
Friend WithEvents ListBox
<System
Me
Me
Me
Me
Me
Me
Me
Me
Me
Me
Me
Me
End Sub
#End Region
Private Sub Form
Handles MyBase
On Error Resume Next
Dim SoundDeviceQuery As New SelectQuery(
Dim SoundDeviceSearch As New ManagementObjectSearcher(SoundDeviceQuery)
Dim SoundDeviceInfo As ManagementObject
For Each SoundDeviceInfo In SoundDeviceSearch
Dim SizeInMBs As Long = (Val(SoundDeviceInfo(
SizeInMBs = Int((SizeInMBs / (
ListBox
ListBox
ListBox
ListBox
ListBox
ListBox
ListBox
ListBox
ListBox
ListBox
ListBox
Next
End Sub
End Class
得到硬盤信息
Imports System
Public Class Form
Inherits System
#Region
Public Sub New()
MyBase
InitializeComponent()
End Sub
Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
If disposing Then
If Not (components Is Nothing) Then
components
End If
End If
MyBase
End Sub
Private components As System
Friend WithEvents ListBox
<System
Me
Me
Me
Me
Me
Me
Me
Me
Me
Me
Me
Me
End Sub
#End Region
Private Sub Form
On Error Resume Next
Dim HDDDeviceQuery As New SelectQuery(
Dim HDDDeviceSearch As New ManagementObjectSearcher(HDDDeviceQuery)
Dim HDDDeviceInfo As ManagementObject
For Each HDDDeviceInfo In HDDDeviceSearch
ListBox
ListBox
ListBox
ListBox
ListBox
ListBox
ListBox
ListBox
ListBox
ListBox
ListBox
ListBox
ListBox
ListBox
ListBox
Next
End Sub
End Class
得到聲卡信息
Imports System
Public Class Form
Inherits System
#Region
Public Sub New()
MyBase
InitializeComponent()
End Sub
Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
If disposing Then
If Not (components Is Nothing) Then
components
End If
End If
MyBase
End Sub
Private components As System
Friend WithEvents ListBox
<System
Me
Me
Me
Me
Me
Me
Me
Me
Me
Me
Me
Me
End Sub
#End Region
Private Sub Form
Dim SoundDeviceQuery As New SelectQuery(
Dim SoundDeviceSearch As New ManagementObjectSearcher(SoundDeviceQuery)
Dim SoundDeviceInfo As ManagementObject
For Each SoundDeviceInfo In SoundDeviceSearch
ListBox
ListBox
ListBox
Next
End Sub
End Class
From:http://tw.wingwit.com/Article/program/net/201311/11413.html