Get current user name from system

H

Homauoon

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
 
T

Thomas Scheidegger [MVP]

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

Ignacio Machin

Hi,

You can use :
WindowsIdentity.GetCurrent().Name



It return the user logged on the system.

Hope this help,
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top