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

[入库:2005年8月18日] [更新:2007年3月24日]

本文简介:选择自 soho_andy 的 blog

        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
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.

class description
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.

class description
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.

class description
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.

本文关键:WMI 系统 信息 硬件 软件
 

本站最佳浏览方式为 分辨率 1024x768 IE 6.0(或更高版本的 IE浏览器)

go top