【VB开源代码栏目提醒】:本文主要为网学会员提供netshare.frm,希望对需要netshare.frm网友有所帮助,学习一下!
VERSION 5.00
Begin VB.Form Form1
BorderStyle = 1 'Fixed Single
Caption = "共享信息与用户名"
ClientHeight = 3030
ClientLeft = 45
ClientTop = 330
ClientWidth = 5175
LinkTopic = "Form1"
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 3030
ScaleWidth = 5175
StartUpPosition = 3 '窗口缺省
Begin VB.CommandButton CmdExit
Caption = "退出"
Height = 375
Left = 3720
TabIndex = 2
Top = 480
Width = 975
End
Begin VB.ListBox List2
Height = 1320
Left = 2640
TabIndex = 4
Top = 1440
Width = 2415
End
Begin VB.ListBox List1
Height = 1320
Left = 120
TabIndex = 3
Top = 1440
Width = 2055
End
Begin VB.ComboBox Combo1
Height = 300
Left = 120
TabIndex = 0
Top = 600
Width = 1935
End
Begin VB.CommandButton CmdOK
Caption = "获取"
Height = 375
Left = 2520
TabIndex = 1
Top = 480
Width = 855
End
Begin VB.Label Label3
Caption = "计算机名:"
Height = 375
Left = 120
TabIndex = 7
Top = 240
Width = 1335
End
Begin VB.Label Label2
Caption = "用户"
Height = 255
Left = 2640
TabIndex = 6
Top = 1080
Width = 615
End
Begin VB.Label Label1
Caption = "共享资源"
Height = 255
Left = 120
TabIndex = 5
Top = 1080
Width = 855
End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
'获取共享信息与用户名
Private Sub CmdOK_Click()
On Error Resume Next '错误处理语句
Dim ComputerName '定义变量
Dim Service
Dim FileService
Dim FileShare
Dim PrintQueue
Dim ContainerPrint
Dim container
List1.Clear '列表框清空
List2.Clear
Combo1.AddItem Combo1.Text '下拉列表框中添加内容
ComputerName = Combo1.Text
Set FileService = GetObject("WinNT://" & ComputerName & "/LanmanServer") '网络计算机的共享文件夹
Set container = GetObject("WinNT://" & ComputerName) '网络计算机名
DoEvents
For Each FileShare In FileService '利用For Each语句显示计算机中所有共享文件夹
List1.AddItem FileShare.Name
Next
DoEvents
container.Filter = Array("User")
Dim user As IADsUser
For Each user In container '在列表框2中显示用户信息
List2.AddItem user.Name
If user.AccountDisabled = True Then
List2.AddItem user.Name
End If
Next
DoEvents
End Sub
'退出程序
Private Sub CmdExit_Click()
Unload Me
End Sub
上一篇:
netsearch.frm
下一篇:
台湾海峡台风浪的数值模拟