国产探花免费观看_亚洲丰满少妇自慰呻吟_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ā)表
主站蜘蛛池模板: 九台市| 弥勒县| 德江县| 普格县| 永城市| 绥江县| 松江区| 敖汉旗| 敖汉旗| 张北县| 湖南省| 安多县| 思茅市| 中西区| 新郑市| 泉州市| 眉山市| 罗定市| 宁阳县| 雷波县| 泽普县| 敦化市| 大英县| 靖江市| 禹城市| 焉耆| 鄂伦春自治旗| 汕尾市| 丰台区| 云南省| 淅川县| 道孚县| 任丘市| 通许县| 温宿县| 和顺县| 阳高县| 延寿县| 阿尔山市| 神木县| 黑山县|