Results 1 to 5 of 5

Thread: Listing Network Computers

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Mar 2006
    Posts
    22

    Listing Network Computers

    I'm looking for a code that lists all computers in the LAN.
    Is it possible? Is it difficult?

    I'm doing the first steps in VB.

    Help me. Thanks on advance

  2. #2
    Frenzied Member the182guy's Avatar
    Join Date
    Nov 2005
    Location
    Cheshire, UK
    Posts
    1,473

    Re: Listing Network Computers

    heres a class that does it, it can get other lists too such as shared list, printer list etc, i;ve attached the class, just add it to the project, and in your form load have something like thie....

    Have a listbox on the form named lstTerminals
    VB Code:
    1. Dim SW As CNetworkEnum 'Decalre class
    2.     Set SW = New CNetworkEnum 'Set class to SW
    3.     Call SW.SetResourceType(0) 'Set resource type
    4.     Call SW.Reset
    5.     Dim ST As String
    6.    
    7.     ST = Replace(SW.GetServerList, "\\", "") 'Replace the \\ in the computer names
    8.  
    9.     'loop through the list of computer names and put the in the listbox
    10.     For i = 1 To Len(ST)
    11.         If Mid(ST, i, 1) = "," Then
    12.         lstTerminals.AddItem (Left(ST, i - 1))
    13.         ST = Right(ST, Len(ST) - i)
    14.         i = 1
    15.         End If
    16.     Next i
    BTW i found this on pscode.com, theres probably more simpler versions, this was just the first I found
    Attached Files Attached Files
    Chris

  3. #3

    Thread Starter
    Junior Member
    Join Date
    Mar 2006
    Posts
    22

    Re: Listing Network Computers

    Thanks @the182guy for you reply.

    I don't know how can I use it! I'm using VB .Net 2003.
    How can I use the code and aply it to a listbox.

    Sorry about the English but I'm a portuguese teenager.
    And sorry for the ignorance!

  4. #4
    Frenzied Member the182guy's Avatar
    Join Date
    Nov 2005
    Location
    Cheshire, UK
    Posts
    1,473

    Re: Listing Network Computers

    Ah sorry, I thought you were using VB6, that code is for VB6, possibly you can use the class in .NET but I really have no idea, try posting in the .NET or API forum as this question is API related and technically is not actually network programming
    Chris

  5. #5

    Thread Starter
    Junior Member
    Join Date
    Mar 2006
    Posts
    22

    Re: Listing Network Computers

    Owever, thanks for all!

    Microbyte

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width