Windows gebruiker opvragen.

Private Declare Function GeefGebruikerNaam Lib "advapi32.dll" Alias "GetUserNameA" _
                (ByVal lpBuffer As String, nSize As Long) As Long
                
                Private Const MAXLEN = 255
                +++++++++++++++++++++++++++++++++++
                Public Function GeefLoginNaam() As String
                Dim strGebruikerNaam As String
                Dim lngGroote As Long
                Dim lngReturn As Long
                
                lngGroote = 256 '255 + nulstring
                Voldoende plaats voor string voorzien
                strGebruikerNaam = Space(MAXLEN) & Chr(0)
                    If GeefGebruikerNaam(strGebruikerNaam, lngGroote) < > 0 Then
                        GeefLoginNaam = Left(strGebruikerNaam, lngGroote - 1)
                    Else
                        GeefLoginNaam = ""
                    End If
                End Function
                
Begin