Results 1 to 4 of 4

Thread: Computer Name

  1. #1

    Thread Starter
    Member
    Join Date
    Aug 2000
    Posts
    54

    Computer Name

    Does anyone know how to get the computer name from a windows box using Vb?

    Thanks for the help in advance.

    -Jason

  2. #2
    Fanatic Member petrus's Avatar
    Join Date
    May 2002
    Location
    pBytes[sizeof(pBytes)/2]
    Posts
    553
    You can use the Winsock. RemoteHost I think
    ICQ: 128716725

  3. #3
    PowerPoster Pasvorto's Avatar
    Join Date
    Oct 2002
    Location
    Minnesota, USA
    Posts
    2,951
    Public Function GetMachineName() As String
    Dim sBuffer As String * 255
    If GetComputerNameA(sBuffer, 255&) <> 0 Then
    GetMachineName = Left$(sBuffer, InStr(sBuffer, vbNullChar) - 1)
    Else
    GetMachineName = "(Not Known)"
    End If
    End Function


    in your code:

    dim glbmachine as string
    glbMachineName = GetMachineName
    If glbMachineName = blah, blah, blah

  4. #4

    Thread Starter
    Member
    Join Date
    Aug 2000
    Posts
    54

    Thanks!!

    The Winsock Worked LocalHostName not remote host. Thanks alot.

    -Jason

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