Results 1 to 3 of 3

Thread: Getting the name of PC

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Feb 1999
    Location
    Caracas, Miranda, Venezuela
    Posts
    69

    Post

    PLEASE, HELP ME!!!
    How can I get the name of PC.?
    Exits any Api?
    Thanks

  2. #2
    New Member
    Join Date
    Jan 2000
    Location
    Australia
    Posts
    9

    Post

    See my post of March 13 - both methods work fine.

  3. #3
    Conquistador
    Join Date
    Dec 1999
    Location
    Australia
    Posts
    4,527

    Post

    try this (it must go in a module)

    Code:
    Declare Function GetComputerName Lib "kernel32.dll" Alias "GetComputerNameA" (ByVal lpBuffer As String, nSize As Long) As Long
    Public Function GetCompName() As String
    Dim compname As String, retval As Long  ' string to use as buffer & return value
    compname = Space(255)  ' set a large enough buffer for the computer name
    retval = GetComputerName(compname, 255)  ' get the computer's name
    ' Remove the trailing null character from the strong
    compname = Left(compname, InStr(compname, vbNullChar) - 1)
    GetCompName = compname
    End Function
    how's that?

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