users_user-20.html - [VB] Récupérer le nom de l'utilisateur
- Private Declare Function GetUserName Lib "advapi32.dll" Alias "GetUserNameA" (ByVal lpBuffer As String, ByRef nSize As Long) As Long
- Private Function UserName() As String
- Dim sUserName As String
- Dim iNb As Long
- 'Créer un tampon
- sUserName = Space(255)
- iNb = 255
- 'lire le nom utilisateur de la sesion windows
- Call GetUserName(sUserName, iNb)
- 'enlever la partie non utilisée du tampon
- sUserName = Left$(sUserName, iNb)
- UserName = sUserName
- End Function
Poster un commentaire