首页 > 开发 > 综合 > 正文

HOW TO:检索本机硬件信息

2024-07-21 02:16:11
字体:
来源:转载
供稿:网友

how to:检索本机硬件信息


 


使用managementclass。下面的示例是检索硬盘信息的。


 


    private sub button1_click(byval sender as system.object, byval e as system.eventargs) handles button1.click



        dim disks as new managementclass("win32_diskdrive")



        dim observer as new managementoperationobserver



        addhandler observer.objectready, addressof onenumobjectready



        disks.getinstances(observer)



    end sub



    sub onenumobjectready(byval sender as object, 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



发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表