转至繁体中文版     | 网站首页 | 图文教程 | 资源下载 | 站长博客 | 图片素材 | 武汉seo | 武汉网站优化 | 
最新公告:     敏韬网|教学资源学习资料永久免费分享站!  [mintao  2008年9月2日]        
您现在的位置: 学习笔记 >> 图文教程 >> 软件开发 >> VB.NET程序 >> 正文
VB中使用WMI获取系统硬件和软件有关信息         ★★★★
Computer system hardware Classes that represent hardware related objects. Operating system Classes that represent operating system related objects. Installed applications Classes that represent software related objects. WMI service management Classes used to manage WMI. Performance counters

Classes that represent formatted and raw performance data.

 

 

硬件类

Computer System Hardware Classes

he Cooling Devices subcategory groups classes that represent instrumentable fans, temperature probes, and refrigeration devices.

Win32_Fan Represents the properties of a fan device in the computer system. Win32_HeatPipe Represents the properties of a heat pipe cooling device. Win32_Refrigeration Represents the properties of a refrigeration device. Win32_TemperatureProbe Represents the properties of a temperature sensor (electronic thermometer).

Input Device Classes

The Input Devices subcategory groups classes that represent keyboards and pointing devices.

Win32_Keyboard Represents a keyboard installed on a Windows system. Win32_PointingDevice Represents an input device used to point to and select regions on the display of a Windows computer system.

Mass Storage Classes

Classes in the Mass Storage subcategory represent storage devices such as hard disk drives, CD-ROM drives, and tape drives.

Win32_AutochkSetting Represents the settings for the autocheck operation of a disk. Win32_CDROMDrive Represents a CD-ROM drive on a Windows computer system. Win32_DiskDrive Represents a physical disk drive as seen by a computer running the Windows operating system. Win32_FloppyDrive Manages the capabilities of a floppy disk drive. Win32_PhysicalMedia Represents any type of documentation or storage medium. Win32_TapeDrive Represents a tape drive on a Windows computer.

Motherboard, Controller, and Port Classes

The Motherboard, Controllers, and Ports subcategory groups classes that represent system devices. Examples include system memory, cache memory, and controllers.

Win32_1394Controller Represents the capabilities and management of a 1394 controller. Win32_1394ControllerDevice Relates the high-speed serial bus (IEEE 1394 Firewire) Controller and the CIM_LogicalDevice instance connected to it. Win32_AllocatedResource Relates a logical device to a system resource. Win32_AssociatedProcessorMemory Relates a processor and its cache memory. Win32_BaseBoard Represents a baseboard (also known as a motherboard or system board). Win32_BIOS Represents the attributes of the computer system''''s basic input/output services (BIOS) that are installed on the computer. Win32_Bus Represents a physical bus as seen by a Windows operating system. Win32_CacheMemory Represents cache memory (internal and external) on a computer system. Win32_ControllerHasHub Represents the hubs downstream from the universal serial bus (USB) controller. Win32_DeviceBus Relates a system bus and a logical device using the bus. Win32_DeviceMemoryAddress Represents a device memory address on a Windows system. Win32_D

[1] [2] [3]  下一页


[常用软件]在Maxthon中使用Google网站加速器  [常用软件]在POWERBUILDER中使用WINSOCK控件的方法
[VB.NET程序]在VB.NET中使用MS Access存储过程 — 第二部份  [VB.NET程序]在VB.NET中使用MS Access存储过程 — 第一部份
[VB.NET程序]在 VB 中使用 Unicode API  [Delphi程序]DELPHI中使用API函数详解
[Delphi程序]在Delphi中使用Queued 组件  [Delphi程序]在delphi中使用flash控件
[Delphi程序]在delphi中使用xml文档有两种方法  [Delphi程序]Delphi 7 中使用RAVE报表(一)

VB中使用WMI获取系统硬件和软件有关信息

作者:闵涛 文章来源:闵涛的学习笔记 点击数:3532 更新时间:2009/4/23 18:59:16

在VB中使用WMI获取系统硬件和软件有关信息

简介:

      WMI是英文Windows Management
      Instrumentation的简写,它的功能主要是:访问本地主机的一些信息和服务,可以管理远程计算机(当然你必须要拥有足够的权限),比如:重启,关机,关闭进程,创建进程等。

实例如下:

''''用WMI,先工程-引用 Microsoft WMI Scripting V1.1 Library

    获取显卡/声卡/内存/操作系统的信息

   声卡信息

Private Sub wmiSoundDeviceInfo()

   Dim wmiObjSet As SWbemObjectSet
   Dim obj As SWbemObject
  
   Set wmiObjSet = GetObject("winmgmts:{impersonationLevel=impersonate}"). _
                          InstancesOf("Win32_SoundDevice")
   On Local Error Resume Next
  
   For Each obj In wmiObjSet
      MsgBox obj.ProductName
   Next
End Sub

 

显卡信息

Private Sub wmiVideoControllerInfo()

   Dim wmiObjSet As SWbemObjectSet
   Dim obj As SWbemObject
  
   Set wmiObjSet = GetObject("winmgmts:{impersonationLevel=impersonate}"). _
                          InstancesOf("Win32_VideoController")
  
   On Local Error Resume Next
  
   For Each obj In wmiObjSet
      MsgBox obj.VideoProcessor
   Next
End Sub

内存信息

Private Sub wmiPhysicalMemoryInfo()

   Dim wmiObjSet As SWbemObjectSet
   Dim obj As SWbemObject
  
   Set wmiObjSet = GetObject("winmgmts:{impersonationLevel=impersonate}"). _
                          InstancesOf("Win32_PhysicalMemory")
  
   On Local Error Resume Next
  
   For Each objItem In wmiObjSet
        Debug.Print "BankLabel: " & objItem.BankLabel
        Debug.Print "Capacity: " & objItem.Capacity
        Debug.Print "Caption: " & objItem.Caption
        Debug.Print "CreationClassName: " & objItem.CreationClassName
        Debug.Print "DataWidth: " & objItem.DataWidth
        Debug.Print "Description: " & objItem.Description
        Debug.Print "DeviceLocator: " & objItem.DeviceLocator
        Debug.Print "FormFactor: " & objItem.FormFactor
        Debug.Print "HotSwappable: " & objItem.HotSwappable
        Debug.Print "InstallDate: " & objItem.InstallDate
        Debug.Print "InterleaveDataDepth: " & objItem.InterleaveDataDepth
        Debug.Print "InterleavePosition: " & objItem.InterleavePosition
        Debug.Print "Manufacturer: " & objItem.Manufacturer
        Debug.Print "MemoryType: " & objItem.MemoryType
        Debug.Print "Model: " & objItem.Model
        Debug.Print "Name: " & objItem.name
        Debug.Print "OtherIdentifyingInfo: " & objItem.OtherIdentifyingInfo
        Debug.Print "PartNumber: " & objItem.PartNumber
        Debug.Print "PositionInRow: " & objItem.PositionInRow
        Debug.Print "PoweredOn: " & objItem.PoweredOn
        Debug.Print "Removable: " & objItem.Removable
        Debug.Print "Replaceable: " & objItem.Replaceable
        Debug.Print "SerialNumber: " & objItem.SerialNumber
        Debug.Print "SKU: " & objItem.SKU
        Debug.Print "Speed: " & objItem.Speed
        Debug.Print "Status: " & objItem.Status
        Debug.Print "Tag: " & objItem.Tag
        Debug.Print "TotalWidth: " & objItem.TotalWidth
        Debug.Print "TypeDetail: " & objItem.TypeDetail
        Debug.Print "Version: " & objItem.Version
   Next
End Sub

操作系统信息

Private Sub Command1_Click()
    Dim wmiObjSet As SWbemObjectSet
    Dim obj As SWbemObject
    Dim msg As String
    Dim dtb As String
    Dim d As String
    Dim t As String
    Dim bias As Long
    On Local Error Resume Next
    Set wmiObjSet = GetObject("winmgmts:{impersonationLevel=impersonate}").InstancesOf("Win32_OperatingSystem")
    For Each obj In wmiObjSet
        MsgBox "你当前使用的系统是 " & obj.Caption
    Next
End Sub

说明:

大家可能会发现一个规律,实际上WMI对信息的提取都是使用了WIN32_类库名这样的规律,下列表格就是微软的操作系统各种硬件类的描述

其它WMI管理的类的信息在

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/wmisdk/wmi/accessing_hardware_and_software_through_wmi.asp

可以找到,其中也还有部分示例代码

简单Win_32类表

Win32 Classes

Microsoft® Windows® classes give you the means to manipulate a variety of objects. The following table identifies the categories of Windows classes.

Category Description Class Description Class Description Class Description Class Description
教程录入:mintao    责任编辑:mintao 
  • 上一篇教程:

  • 下一篇教程:
  • 【字体: 】【发表评论】【加入收藏】【告诉好友】【打印此文】【关闭窗口
      注:本站部分文章源于互联网,版权归原作者所有!如有侵权,请原作者与本站联系,本站将立即删除! 本站文章除特别注明外均可转载,但需注明出处! [MinTao学以致用网]
      网友评论:(只显示最新10条。评论内容只代表网友观点,与本站立场无关!)

    同类栏目
    · C语言系列  · VB.NET程序
    · JAVA开发  · Delphi程序
    · 脚本语言
    更多内容
    热门推荐 更多内容
  • 没有教程
  • 赞助链接
    更多内容
    闵涛博文 更多关于武汉SEO的内容
    500 - 内部服务器错误。

    500 - 内部服务器错误。

    您查找的资源存在问题,因而无法显示。

    | 设为首页 |加入收藏 | 联系站长 | 友情链接 | 版权申明 | 广告服务
    MinTao学以致用网

    Copyright @ 2007-2012 敏韬网(敏而好学,文韬武略--MinTao.Net)(学习笔记) Inc All Rights Reserved.
    闵涛 投放广告、内容合作请Q我! E_mail:admin@mintao.net(欢迎提供学习资源)

    站长:MinTao ICP备案号:鄂ICP备11006601号-18

    闵涛站盟:医药大全-武穴网A打造BCD……
    咸宁网络警察报警平台