archana

Hello All

i could not found proper place for my question that's why i am posting it here

i want to enum available computer of network and want to disaply it to user

i use EnumNetwork but it is time taking

i get other BROWSEINFO structure and SHBrowseForFolder api but with this i get machine name as well as shared folder

my requirement is such i want only machine name of network,

can any one please help me out

Thank you




Re: Visual Basic Language Hi

Tapojjwal Mandal

Instead of the machine name you can work also by giving the Ip address of the machine....So please try to get the IP address of your target system.




Re: Visual Basic Language Hi

archana

Thank you for your reply

But my requirement is i want to show user all available computer name of network

and from there user will pick remote machine name

do you have any idea

thank you






Re: Visual Basic Language Hi

rkimble

This depends on the type of network you want to query. If this is an Active Directory network, you can use the System.DirectoryServices namespace to get the machine names from active directory. You will need to add a reference to System.DirectoryServices and then use the Sytem.DirectoryServices.DirectorySearcher to find all computer class objects. The computer name can the be parsed from the object path or read from it's properties collection.

Here is an example that populates a TreeView with computer entries from Active Directory. To try this example, create a new form, add a Button (Button1) and add a TreeView (TreeView1). Anchor the TreeView on all four sides. Add a reference to System.DirectoryServices to the project and then paste in the following code:

Code Snippet

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

Dim srch As New System.DirectoryServices.DirectorySearcher

srch.Filter = "(objectClass=computer)"

Dim reslt As System.DirectoryServices.SearchResultCollection

reslt = srch.FindAll()

Me.TreeView1.BeginUpdate()

For Each res As System.DirectoryServices.SearchResult In reslt

Dim tn As TreeNode

tn = Me.TreeView1.Nodes.Add(res.Path)

For Each rpc As DictionaryEntry In res.Properties

Dim stn As TreeNode

stn = tn.Nodes.Add(rpc.Key)

Dim vals As System.DirectoryServices.ResultPropertyValueCollection

vals = DirectCast(rpc.Value, System.DirectoryServices.ResultPropertyValueCollection)

For i As Integer = 0 To vals.Count - 1

stn.Nodes.Add(vals(i).ToString)

Next

Next

Next

Me.TreeView1.EndUpdate()

End Sub

Run the application and click the button. In a moment, the treeview will be populated with the information for each computer registered in Active Directory.

Hope that helps!

(PS, Also note that I've changed the title of this thread to be something meaningful to the problem at hand)






Re: Visual Basic Language Hi

archana

Thanks for good reply.

But, i am using Visual Basic 6. so plz give me rply according to VB6.

i have used SHGetSpecialFolderLocation(Me.hWnd, CSIDL_NETWORK, pidl) API to get network computer names.

but in this case i m getting shared folders also which i don't want.

i wants to see only computer names.

i can get networkd computer name with using Enum proc but that is taking somuch time.








Re: Visual Basic Language Hi

rkimble

Sorry, but these forums are for .Net languages only. For legacy VB questions, please see the thread http://forums.microsoft.com/MSDN/ShowPost.aspx PostID=478161&SiteID=1

You could also download Visual Basic Express from the VB Developer Center for free. It is time to get up to date as VB6 is on its way out and will eventually not be supported by MS.