Click here to Skip to main content
15,887,881 members
Home / Discussions / Visual Basic
   

Visual Basic

 
AnswerRe: Help: How can I press a button? Pin
Sven Cipido3-Dec-04 3:42
Sven Cipido3-Dec-04 3:42 
GeneralExcuse me, but... Pin
3-Dec-04 3:54
suss3-Dec-04 3:54 
GeneralDesktop Icons Pin
GRMartin3-Dec-04 1:46
GRMartin3-Dec-04 1:46 
GeneralRe: Desktop Icons Pin
MohammadAmiry4-Dec-04 2:53
MohammadAmiry4-Dec-04 2:53 
GeneralCrystal Report Pin
nitin_ion2-Dec-04 22:07
nitin_ion2-Dec-04 22:07 
GeneralRe: Crystal Report Pin
Tom John2-Dec-04 22:18
Tom John2-Dec-04 22:18 
GeneralVB6 - How to list network domains and/or users Pin
steff kamush2-Dec-04 21:11
steff kamush2-Dec-04 21:11 
GeneralRe: VB6 - How to list network domains and/or users Pin
jonathan152-Dec-04 23:09
jonathan152-Dec-04 23:09 
I found these examples a while ago (can't remember where sorry). They are for VB script but you will get the idea.

LISTING 1: The GetAvailableNTDomains Procedure

'----------------------------------------------------------------
' Function: GetAvailableNTDomains
' Description: Returns a listing of available NT Domains
' Parameters: None
' Returns: Variant array of NT Domain names.
'----------------------------------------------------------------
Public Function GetAvailableNTDomains()
Dim objIADsContainer ' ActiveDs.IADsContainer
Dim objIADsDomain ' ActiveDs.IADsDomain
Dim vReturn ' Variant

ReDim vReturn(0)

Set objIADsContainer = GetObject("WinNT:")
For Each objIADsDomain In objIADsContainer
If Trim(vReturn(0)) <> "" Then
ReDim Preserve vReturn(UBound(vReturn) + 1)
End If
vReturn(UBound(vReturn)) = objIADsDomain.Name
Next

Set objIADsDomain = Nothing
Set objIADsContainer = Nothing
GetAvailableNTDomains = vReturn
End Function

LISTING 2: The GetDomainComputers Procedure

'----------------------------------------------------------------
' Function: GetDomainComputers
' Description: Returns a listing of NT Computer Accounts for a
' given domain
' Parameters: ByVal strDomain - Name of an NT Domain to retrieve
' the list of Computer from.
' Returns: Variant array of NT Computer names for the
' specified domain.
'----------------------------------------------------------------
Public Function GetDomainComputers(ByVal strDomain)
Dim objIADsContainer ' ActiveDs.IADsDomain -
' Container object
Dim objIADsComputer ' ActiveDs.IADsComputer
Dim vReturn ' Variant

' connect to the computer.
Set objIADsContainer = GetObject("WinNT://" & strDomain)

' set the filter to retrieve only objects of class Computer
objIADsContainer.Filter = Array("Computer")

ReDim vReturn(0)
For Each objIADsComputer In objIADsContainer
If Trim(vReturn(0)) <> "" Then
ReDim Preserve vReturn(UBound(vReturn) + 1)
End If
vReturn(UBound(vReturn)) = objIADsComputer.Name
Next

GetDomainComputers = vReturn
Set objIADsComputer = Nothing
Set objIADsContainer = Nothing
End Function


The GetComputerUsers Procedure

'----------------------------------------------------------------
' Function: GetComputerUsers
' Description: This function will return the names of the users
' for a specified computer or domain
' Parameters: ByVal strComputerName - Name of an NT Computer or
' domain to retrieve the list of Users from.
' Returns: Variant array of user account for the specified
' computer
'----------------------------------------------------------------

Function GetComputerUsers(ByVal strComputerName)
Dim objIADsContainer 'As ActiveDs.IADsContainer
Dim objIADsUser 'As ActiveDs.IADsUser
Dim vReturn 'As Variant
ReDim vReturn(0)

' Connect to the computer or domain
Set objIADsContainer = GetObject("WinNT://" & strComputerName)

' apply a filter to retrieve only objects of class User
objIADsContainer.Filter = Array("User")

' iterate all user objects within the container
For Each objIADsUser In objIADsContainer
If Trim(vReturn(0)) <> "" Then
ReDim Preserve vReturn(UBound(vReturn) + 1)
End If
vReturn(UBound(vReturn)) = objIADsUser.Name
Next

Set objIADsUser = Nothing
Set objIADsContainer = Nothing
GetComputerUsers = vReturn
End Function


Jon
Generalaccess database question Pin
Member 14960382-Dec-04 14:41
Member 14960382-Dec-04 14:41 
GeneralRe: access database question Pin
doWhileSomething4-Dec-04 15:15
doWhileSomething4-Dec-04 15:15 
GeneralQuestion about sale Pin
safran662-Dec-04 12:58
safran662-Dec-04 12:58 
GeneralRe: Question about sale Pin
Purple Monk3-Dec-04 4:02
Purple Monk3-Dec-04 4:02 
GeneralRe: Question about sale Pin
safran663-Dec-04 18:54
safran663-Dec-04 18:54 
GeneralRe: Question about sale Pin
MohammadAmiry4-Dec-04 2:49
MohammadAmiry4-Dec-04 2:49 
GeneralFree reporting tool Pin
Mekong River2-Dec-04 10:04
Mekong River2-Dec-04 10:04 
GeneralRe: Free reporting tool Pin
safran662-Dec-04 12:44
safran662-Dec-04 12:44 
Generalserialization of datagridtablestyle Pin
frush1232-Dec-04 8:18
frush1232-Dec-04 8:18 
GeneralRe: serialization of datagridtablestyle Pin
Tom John3-Dec-04 2:03
Tom John3-Dec-04 2:03 
GeneralRe: serialization of datagridtablestyle Pin
frush1233-Dec-04 2:07
frush1233-Dec-04 2:07 
GeneralRe: serialization of datagridtablestyle Pin
Tom John3-Dec-04 2:41
Tom John3-Dec-04 2:41 
GeneralRe: serialization of datagridtablestyle Pin
frush1233-Dec-04 2:59
frush1233-Dec-04 2:59 
GeneralRe: serialization of datagridtablestyle Pin
Tom John3-Dec-04 3:14
Tom John3-Dec-04 3:14 
GeneralRe: serialization of datagridtablestyle Pin
Anonymous3-Dec-04 12:21
Anonymous3-Dec-04 12:21 
GeneralProblems with code Pin
Tech 4 a dummy2-Dec-04 4:28
Tech 4 a dummy2-Dec-04 4:28 
GeneralRe: Problems with code Pin
The Man from U.N.C.L.E.2-Dec-04 5:28
The Man from U.N.C.L.E.2-Dec-04 5:28 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.