ZjiÜt∞nφ aktußlnφho p°ihlßÜenΘho u₧ivatele

Postup:
V deklaraΦnφ Φßsti formulß°e zapiÜte:

Private Declare Function GetUserName Lib "advapi32.dll" Alias _
"GetUserNameA" (ByVal lpBuffer As String, nSize As Long) _
As Long

Na formulß° p°idejte tlaΦφtko. Na udßlost Click tlaΦφtka:

Private Sub Command1_Click()

   Dim s As String
   Dim cnt As Long
   Dim dl As Long
   Dim CurUser As String

   cnt = 199
   s = String$(200, 0)
   dl = GetUserName(s, cnt)
   If dl <> 0 Then CurUser = Left$(s, cnt) Else CurUser = ""
   MsgBox CurUser

End Sub
   

Zp∞t

Autor: The Bozena