Connecting Tech Pros Worldwide Help | Site Map

Get current user name from system

Homauoon
Guest
 
Posts: n/a
#1: Nov 13 '05
Dear sir
I want to get current user name from system
(in windows applications) by using WNetGetUser
function from Mpr.lib.
Please help me.
Thanks
Thomas Scheidegger [MVP]
Guest
 
Posts: n/a
#2: Nov 13 '05

re: Get current user name from system


To get the current user, better switch to .NET:
Environment.UserName
or
System.Windows.Forms.SystemInformation.UserName



--
Thomas Scheidegger - MVP .NET - 'NETMaster'
http://www.cetus-links.org/oo_dotnet.html - http://dnetmaster.net/


Ignacio Machin
Guest
 
Posts: n/a
#3: Nov 13 '05

re: Get current user name from system


Hi,

You can use :
WindowsIdentity.GetCurrent().Name



It return the user logged on the system.

Hope this help,
--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation

"Homauoon" <hmmahboobi@yahoo.com> wrote in message
news:03df01c3493b$fd3c2020$a501280a@phx.gbl...
[color=blue]
> Dear sir
> I want to get current user name from system
> (in windows applications) by using WNetGetUser
> function from Mpr.lib.
> Please help me.
> Thanks[/color]


Closed Thread