Option Explicit
Private Declare Function GetComputerName Lib "kernel32.dll" Alias _
"GetComputerNameA" (ByVal lpBuffer As String, nSize As Long) As Long
Private Sub Command1_Click()
Dim strCompName As String
Dim rVal As Long
Dim lngLen As Long
strCompName = Space(255)
lngLen = 255
rVal = GetComputerName(strCompName, lngLen)
MsgBox Left(strCompName, lngLen)
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.