'Add a module to your project (In the menu choose Project -> Add Module, Then click Open)
'Insert this code to the module :
Declare Function GetComputerName Lib "kernel32" Alias _
"GetComputerNameA" (ByVal lpBuffer As String, nSize As Long) As Long
'Insert this code to your form:
Private Sub Form_Load()
MsgBox sGetComputerName
End Sub
Function sGetComputerName() As String
Dim sBuffer As String
Dim lBufSize As Long
Dim lStatus As Long
lBufSize = 255
sBuffer = String$(lBufSize, " "
lStatus = GetComputerName(sBuffer, lBufSize)
sGetComputerName = ""
If lStatus <> 0 Then sGetComputerName = Left(sBuffer, lBufSize)
End Function
Eric De Decker
vbg.be@vbgroup.nl
Licence And Copy Protection AxtiveX
Source CodeBook for the programmer
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.