Connecting Tech Pros Worldwide Help | Site Map

Get current user name from system

 
LinkBack Thread Tools Search this Thread
  #1  
Old November 13th, 2005, 08:19 PM
Homauoon
Guest
 
Posts: n/a
Default Get current user name from system

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, 08:19 PM
Thomas Scheidegger [MVP]
Guest
 
Posts: n/a
Default 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, 08:20 PM
Ignacio Machin
Guest
 
Posts: n/a
Default 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]


 

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Popular Articles

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over 220,662 network members.