Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Getting the user name?
Message
From
21/10/1998 01:47:01
Penmetsa Sridhar
Visualsoft Technologies Limited
Hyderabad, India
 
General information
Forum:
Visual Basic
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00141215
Message ID:
00148774
Views:
25
U can also get the User Name using this API

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

-----
Dim s As String
Dim cnt As Long
Dim dl As Long


cnt = 199
s = String$(200, 0)
dl = GetUserName(s, cnt)
If dl <> 0 Then
usernm = ConvertString(s, cnt)
Else
usernm = ""
End If
-------


Function ConvertString(tmpVal As String, KeyValSize As Long) As String
If (Asc(Mid(tmpVal, KeyValSize, 1)) = 0) Then
' Win95 Adds Null Terminated String...
ConvertString = Left(tmpVal, KeyValSize - 1)
' Null Found, Extract From String
Else
' WinNT Does NOT Null Terminate String...
ConvertString = Left(tmpVal, KeyValSize)
' Null Not Found, Extract String Only
End If
End Function
Previous
Reply
Map
View

Click here to load this message in the networking platform