Results 1 to 2 of 2

Thread: get computername

  1. #1

    Thread Starter
    Junior Member
    Join Date
    May 2002
    Location
    ibadan nigeria
    Posts
    17

    get computername

    i know an API does that but i can just use it correctly.i will appreciate you showing me with some codes

  2. #2
    Frenzied Member KayJay's Avatar
    Join Date
    Jul 2001
    Location
    Chennai
    Posts
    1,849
    VB Code:
    1. 'example by Donavon Kuhn ([email protected])
    2. Private Const MAX_COMPUTERNAME_LENGTH As Long = 31
    3. Private Declare Function GetComputerName Lib "kernel32" Alias "GetComputerNameA" (ByVal lpBuffer As String, nSize As Long) As Long
    4. Private Sub Form_Load()
    5.     Dim dwLen As Long
    6.     Dim strString As String
    7.     'Create a buffer
    8.     dwLen = MAX_COMPUTERNAME_LENGTH + 1
    9.     strString = String(dwLen, "X")
    10.     'Get the computer name
    11.     GetComputerName strString, dwLen
    12.     'get only the actual data
    13.     strString = Left(strString, dwLen)
    14.     'Show the computer name
    15.     MsgBox strString
    16. End Sub

    "Brothers, you asked for it."
    ...Francisco Domingo Carlos Andres Sebastian D'Anconia

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