|
Recuperare il nome dell'utente attualmente loggato
Questo semplice esempio restituisce il nome dell'utente attualmente loggato a Windows. Il sorgente è compatibile con Visual Basic 5 e Visual Basic 6
Public Declare Function GetUserName Lib "advapi32.dll" Alias "GetUserNameA" (ByVal lpBuffer As String, byRef nSize As Long) As Long
Public Function GetUName() As String '*********************************************************************** 'Func.: GetUName (SB-29/03/2000; Mod.: ) 'Desc.: Restituisce l'user name d'accesso a Windows 'Par. : 'Ret. : Stringa con il nome dell'utente corrente '*********************************************************************** Dim sBuffer As String Dim lSize As Long sBuffer = Space(256) lSize = Len(sBuffer) Call GetUserName(sBuffer, lSize) If lSize > 0 Then GetUName = Left(sBuffer, lSize - 1) Else GetUName = "" End If End Function
 martedì, 27 feb 2007 Ore. 13.55
|
Statistiche |
- Views Home Page: 112.242
- Views Posts: 571.213
- Views Gallerie: 120.825
- n° Posts: 227
- n° Commenti: 222
|
|