Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
Option Compare Text
Option Explicit
Declare Function wu_GetUserName Lib "advapi32.dll" Alias "GetUserNameA" _
(ByVal lbBuffer As String, nsize As Long) As Long
Declare Function wu_GetComputerName Lib "kernel32" Alias _
"GetComputerNameA" (ByVal lpBuffer As String, nsize As Long) As Long
Public Function ap_GetUserName() As Variant
Dim strUserName As String
Dim lngLength As Long
Dim lngResult As Long
'----- Set up the buffer
strUserName = String$(255, 0)
lngLength = 255
'----- Make the call
lngResult = wu_GetUserName(strUserName, lngLength)
'----- Assign the value
ap_GetUserName = strUserName
ap_GetUserName = Left(strUserName, InStr(1, strUserName, _
Chr(0)) - 1)
End Function
Public Function ap_GetComputerName()
Dim strComputerName As String
Dim lngLength As Long
Dim lngResult As Long
'----- Set up the buffer
strComputerName = String$(255, 0)
lngLength = 255
'----- Make the call
lngResult = wu_GetComputerName(strComputerName, lngLength)
'----- Clean up and assign the value
ap_GetComputerName = Left(strComputerName, InStr(1, strComputerName, _
Chr(0)) - 1)
End Function