国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 開發(fā) > 綜合 > 正文

HOW TO:枚舉網(wǎng)絡(luò)鄰居的計算機(jī)及其共享文件夾

2024-07-21 02:15:54
字體:
供稿:網(wǎng)友

關(guān)鍵引用空間:system.directoryservices,system.management



說明:form上有一個treeview1,button1



代碼如下:



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



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



        getnetcomputernameandsharefolder()



    end sub




 


    private sub getnetcomputernameandsharefolder()



        dim n as treenode = addnode("工作組或域")



        dim root as directoryentry = new directoryentry("winnt:")



        for each domain as directoryentry in root.children



            '枚舉工作組或域



            dim n1 as treenode = addnode(n, domain.name)



            for each computer as directoryentry in domain.children



                '枚舉指定工作組或域的計算機(jī)



                if computer.schemaclassname.equals("computer") then



                    dim n2 as treenode = addnode(n1, computer.name)



                    '枚舉指定計算機(jī)的共享文件夾



                    dim o as new managementobject



                    o.scope = new managementscope(string.format("http://{0}/root/cimv2", computer.name))



                    dim searcher as managementobjectsearcher = new managementobjectsearcher("select * from win32_share")



                    searcher.scope = o.scope



                    for each share as managementobject in searcher.get()



                        addnode(n2, share.getpropertyvalue("name").tostring)



                    next



                end if



            next



        next



    end sub




 


    private function addnode(byval text as string) as treenode



        return me.treeview1.nodes.add(text)



    end function




 


    private function addnode(byval node as treenode, byval text as string) as treenode



        return node.nodes.add(text)



    end function



 




 





發(fā)表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發(fā)表
主站蜘蛛池模板: 栾川县| 疏附县| 兴义市| 三原县| 博白县| 台山市| 双城市| 靖宇县| 长兴县| 灵川县| 阿拉善左旗| 绥芬河市| 陇南市| 临泉县| 新乐市| 中超| 普兰店市| 曲周县| 永靖县| 五寨县| 镇赉县| 峡江县| 启东市| 麻江县| 本溪市| 睢宁县| 土默特右旗| 辽宁省| 集安市| 伊吾县| 大名县| 五台县| 米泉市| 沈丘县| 安庆市| 吉木乃县| 祥云县| 杭锦旗| 额敏县| 顺平县| 禹城市|