Is there a function to get a users computer name ?
From: Shamil Salakhetdinov <shamil@marta.darts.spb.ru>
To: ACCESS-L <ACCESS-L@PEACH.EASE.LSOFT.COM>
Subject: Re: Computer Name?
Date: 27 May 1998 10:07
Doug,
This code should work:
Declare Function api32_GetComputerName Lib "kernel32" Alias "GetComputerNameA" _
(ByVal lpBuffer As String, nSize As Long) As Long
Public Function smsGetComputerName() As String
On Error Resume Next
Dim strComputerName As String * 512
Dim lngBufLen As Long
Dim lngRet As Long
lngBufLen = 503
strComputerName = String(512, 0)
lngRet = api32_GetComputerName(strComputerName, lngBufLen)
If lngRet <> 0 Then
smsGetComputerName = Left(strComputerName, lngBufLen)
Else
smsGetComputerName = ""
End If
End Function
HTH,
Shamil
| HOME TOPICS |
Copyright © 19981999 by Shamil Salakhetdinov.
|
| Last updated: October 10, 2006
Published also here at 4TOPS: Get Computer Name |
|