你要看看能不以能用引用到这个ActiveDS.tlb
下面是用这个取得的
Create a Standard EXE project in Visual Basic. Form1 is created by default.
Set a reference to the Active DS Type Library by selecting Project, References, and then selecting Active DS Type Library.NOTE: You may not see the Active DS Type Library in the list of available References. To add the Library to the list:
Click Browse.
Go to the Windows\System folder or WinNT\System32 folder.
Select the file ActiveDS.tlb.
From now on, the Active DS Type Library is among the list of available References.
Add a ListBox and CommandButton to Form1.
Add the following code to Form1's Code Window.
Private Sub Command1_Click() Dim TheDomain As IADsDomain
Dim Computer As IADsComputer
Dim strDomain As String
Dim iMousePointer As Integer 'Accept the Domain name
strDomain = InputBox("Domain Name: ") 'Use the WinNT Directory Services
strDomain = "WinNT://" & strDomain 'Initialize the User Interface
List1.Clear
iMousePointer = Me.MousePointer
Me.MousePointer = vbHourglass 'Create the Domain object
Set TheDomain = GetObject(strDomain) 'Search for Computers in the Domain
TheDomain.Filter = Array("Computer") For Each Computer In TheDomain
List1.AddItem Computer.Name
Next Computer 'Clean up
Me.MousePointer = iMousePointer
Set Computer = Nothing
Set TheDomain = NothingEnd Sub 'Command1_Click
Run the test project by doing the following:
Click CommandButton.
When prompted, enter the Domain name. Depending on the number of computers in the domain, the enumeration may take a while.
下面是用这个取得的
Create a Standard EXE project in Visual Basic. Form1 is created by default.
Set a reference to the Active DS Type Library by selecting Project, References, and then selecting Active DS Type Library.NOTE: You may not see the Active DS Type Library in the list of available References. To add the Library to the list:
Click Browse.
Go to the Windows\System folder or WinNT\System32 folder.
Select the file ActiveDS.tlb.
From now on, the Active DS Type Library is among the list of available References.
Add a ListBox and CommandButton to Form1.
Add the following code to Form1's Code Window.
Private Sub Command1_Click() Dim TheDomain As IADsDomain
Dim Computer As IADsComputer
Dim strDomain As String
Dim iMousePointer As Integer 'Accept the Domain name
strDomain = InputBox("Domain Name: ") 'Use the WinNT Directory Services
strDomain = "WinNT://" & strDomain 'Initialize the User Interface
List1.Clear
iMousePointer = Me.MousePointer
Me.MousePointer = vbHourglass 'Create the Domain object
Set TheDomain = GetObject(strDomain) 'Search for Computers in the Domain
TheDomain.Filter = Array("Computer") For Each Computer In TheDomain
List1.AddItem Computer.Name
Next Computer 'Clean up
Me.MousePointer = iMousePointer
Set Computer = Nothing
Set TheDomain = NothingEnd Sub 'Command1_Click
Run the test project by doing the following:
Click CommandButton.
When prompted, enter the Domain name. Depending on the number of computers in the domain, the enumeration may take a while.
不满意不满意,还有没有??????