Get current user name from system

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Homauoon

    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
  • Thomas Scheidegger [MVP]

    #2
    Re: Get current user name from system

    To get the current user, better switch to .NET:
    Environment.Use rName
    or
    System.Windows. Forms.SystemInf ormation.UserNa me



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


    Comment

    • Ignacio Machin

      #3
      Re: Get current user name from system

      Hi,

      You can use :
      WindowsIdentity .GetCurrent().N ame



      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@yah oo.com> wrote in message
      news:03df01c349 3b$fd3c2020$a50 1280a@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]


      Comment

      Working...