HOW TO: Retrieve this machine hardware information

xiaoxiao2021-03-05  37

HOW TO: Retrieve this machine hardware information

Use managementclass. The following example is to retrieve hard disk information.

Private sub button1_click (byvale as system.object, byval e as system.eventargs) Handles Button1.click

DIM Disks as new managementClassClass ("Win32_DiskDrive")

DIM OBSERVER AS New ManagementOperationObserver

AddHandler Observer.ObjectReady, Addressof OnenumObjectReady

Disks.getinstances (Observer)

End Sub

Sub OnenumObjectReady (Byval E as ObjectReadyeventargs)

Console.writeline ("************************************************** ********* ")

Console.writeline (E.NewObject.properties ("description"). Value)

Console.writeline (E.Newobject.properties ("caption"). Value)

Console.writeLine (E.NewObject.properties ("DeviceID"). Value)

End Sub

转载请注明原文地址:https://www.9cbs.com/read-34917.html

New Post(0)