Connecting Tech Pros Worldwide Help | Site Map

Get current user name from system

  #1  
Old November 13th, 2005, 09:19 PM
Homauoon
Guest
 
Posts: n/a
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
  #2  
Old November 13th, 2005, 09:19 PM
Thomas Scheidegger [MVP]
Guest
 
Posts: n/a

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/


  #3  
Old November 13th, 2005, 09:20 PM
Ignacio Machin
Guest
 
Posts: n/a

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Active Directory User Name from Logon Name Arthur answers 18 October 24th, 2006 06:15 PM
interactive user name from within service ChrisB4745 answers 2 November 16th, 2005 06:33 AM
interactive user name from within service ChrisB4745 answers 0 November 16th, 2005 06:29 AM
might be a little over the ability of access but can I get user name from system? sparks answers 3 November 12th, 2005 04:43 PM