Get "Name" of the person "Logged On" to the

In this category you can exchange your programming questions and solutions.
Post Reply
Darren
Posts: 63
Joined: Wed May 11, 2011 11:55 am

Get "Name" of the person "Logged On" to the

Post: # 1030Post Darren
Fri Jan 18, 2013 10:18 am

Can anybody tell me how I can get the current "User Name" of the person logged onto the computer?

Marco
Site Admin
Posts: 246
Joined: Sat Sep 15, 2018 8:41 pm

Get "Name" of the person "Logged On" to the

Post: # 1031Post Marco
Thu Jan 24, 2013 4:34 pm

`get username

Declare GetUserName as "GetUserNameA" of advapi32.dll
  lpBuffer As string byaddress
  nSize As Long
  result as long
end declare

dim b as integer
b=250
getusername.nsize=varptr(b)
getusername.execute
if getusername.result=true then
  showmessage getusername.lpbuffer
else
  showmessage "Error,Username not found"
end if

best regards

Post Reply