Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Getting the user name?
Message
General information
Forum:
Visual Basic
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00141215
Message ID:
00141338
Views:
24
Yes ther's one. Try :

Declare Function GetUserName Lib "advapi32.dll" Alias "GetUserNameA" ( _
ByVal lpBuffer As String, _
nSize As Long) _
As Long
Declare Function GetComputerName Lib "kernel32" Alias "GetComputerNameA" (_
ByVal lpBuffer As String, _
nSize As Long) _
as long

Dim sTmp As String
Dim R As Long
Dim sUserName As String
Dim sComputerName As String

sTmp = String(100, Chr$(0))
R = GetUserName(sTmp, 100)
sUserName = Left(sTmp, InStr(sTmp, Chr$(0)) - 1)
R = GetComputerName(sTmp, 100)
sComputerName = Left(sTmp, InStr(sTmp, Chr$(0)) - 1)
VB Developer
Servilog Concept
jmb@octalfrance.com
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform