Results 1 to 8 of 8

Thread: [RESOLVED] Get computer name

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Apr 2006
    Location
    Sweden
    Posts
    173

    Resolved [RESOLVED] Get computer name

    Hi,

    How do I get the computer name? There must be some kind of function for it...

    Plz help!

    //Alex
    Last edited by Hack; May 25th, 2006 at 09:14 AM. Reason: Added [RESOLVED] to thread title and green "resolved" checkmark
    Please Help Us To Save Ana

    You never fail before you stop trying!
    ______________________________
    If I manage to say something good...please reputate
    ______________________________
    ________

    Links:
    Intellithing
    Digitala.nu
    Norrköpings Goklubb
    WoW Trade Center

  2. #2
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Re: Get computer name

    VB Code:
    1. Private Declare Function GetComputerName Lib "kernel32" _
    2. Alias "GetComputerNameA" (ByVal lpBuffer As String, nSize As Long) As Long
    3.  
    4. Private strMachineName As String
    5.  
    6. Private Sub GetMachineName()
    7.     Dim sBuffer As String
    8.     Dim lSize As Long
    9.     sBuffer = Space$(255)
    10.     lSize = Len(sBuffer)
    11.  
    12.     Call GetComputerName(sBuffer, lSize)
    13.     If lSize > 0 Then
    14.         strMachineName = Left$(sBuffer, lSize)
    15.     Else
    16.         strMachineName = vbNullString
    17.     End If
    18.    
    19. End Sub

  3. #3
    Super Moderator manavo11's Avatar
    Join Date
    Nov 2002
    Location
    Around the corner from si_the_geek
    Posts
    7,171

    Re: Get computer name

    Look here : http://www.allapi.net/apilist/GetComputerName.shtml at the GetComputerName example


    Has someone helped you? Then you can Rate their helpful post.

  4. #4

    Thread Starter
    Addicted Member
    Join Date
    Apr 2006
    Location
    Sweden
    Posts
    173

    Re: Get computer name

    tnx a lot man!
    Please Help Us To Save Ana

    You never fail before you stop trying!
    ______________________________
    If I manage to say something good...please reputate
    ______________________________
    ________

    Links:
    Intellithing
    Digitala.nu
    Norrköpings Goklubb
    WoW Trade Center

  5. #5
    Learning .Net danasegarane's Avatar
    Join Date
    Aug 2004
    Location
    VBForums
    Posts
    5,853

    Re: [RESOLVED] Get computer name

    you can use a winsock control in your program.Place the winsock control in the form . By that u can get the computer name as winsock1.hostname

  6. #6
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Re: [RESOLVED] Get computer name

    Quote Originally Posted by danasegarane
    you can use a winsock control in your program.Place the winsock control in the form . By that u can get the computer name as winsock1.hostname
    That is true, but that would also mean rolling out and installing an OCX that might not be needed for anything else.

    If Winsock were used in other parts of the program, then this is definately the way I would go as the API would no longer be needed.

  7. #7

    Thread Starter
    Addicted Member
    Join Date
    Apr 2006
    Location
    Sweden
    Posts
    173

    Re: [RESOLVED] Get computer name

    mm, I think I'll go on the first example
    Please Help Us To Save Ana

    You never fail before you stop trying!
    ______________________________
    If I manage to say something good...please reputate
    ______________________________
    ________

    Links:
    Intellithing
    Digitala.nu
    Norrköpings Goklubb
    WoW Trade Center

  8. #8
    Learning .Net danasegarane's Avatar
    Join Date
    Aug 2004
    Location
    VBForums
    Posts
    5,853

    Re: [RESOLVED] Get computer name

    thanks

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