CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Join Date
    Jul 2001
    Posts
    23

    Getting User Info

    I want to extract the details of a particular user
    who has an account in 2000 Server.I used the
    API NetUserGetInfo. I called the API in a command click .
    But it is not working.The code is as below


    Public Type USER_INFO_3
    usri3_name As Long
    usri3_password As Long
    usri3_password_age As Long
    usri3_priv As Long
    usri3_home_dir As Long
    usri3_comment As Long
    usri3_flags As Long
    usri3_script_path As Long
    usri3_auth_flags As Long
    usri3_full_name As Long
    usri3_usr_comment As Long
    usri3_parms As Long
    usri3_workstations As Long
    usri3_last_logon As Long
    usri3_last_logoff As Long
    usri3_acct_expires As Long
    usri3_max_storage As Long
    usri3_units_per_week As Long
    usri3_logon_hours As Long
    usri3_bad_pw_count As Long
    usri3_num_logons As Long
    usri3_logon_server As Long
    usri3_country_code As Long
    usri3_code_page As Long
    usri3_user_id As Long
    usri3_primary_group_id As Long
    usri3_profile As Long
    usri3_home_dir_drive As Long
    usri3_password_expired As Long
    End Type

    Public Declare Function NetUserGetInfo Lib "Netapi32.dll" ( _
    strServerName As Any, strUserName As Any, ByVal dwLevel As Long, _
    pBuffer As Long) As Long

    Private Sub Command4_Click()
    Dim pUser As String
    Dim pServer As String

    Dim dwLevel As Long
    dwLevel = 3
    Dim tmpBuffer As USER_INFO_3
    Dim ptmpBuffer As Long
    NetUserGetInfo pServer, pUser, dwLevel, tmpBuffer

    MsgBox tmpBuffer.usri3_full_name
    End Sub



  2. #2
    Join Date
    Mar 2001
    Posts
    71

    Re: Getting User Info

    Hi,

    I have tried following on NT.Don't know about 2000.
    This example gives u the currently logged in user name


    private Declare Function GetUserName Lib "advapi32.dll" Alias "GetUserNameA" (byval lpBuffer as string, nSize as Long) as Long
    private Sub Form_Load()
    Dim strTemp as string, strUserName as string
    strUserName = string(100, Chr$(0))
    GetUserName strUserName, 100
    strUserName = Left$(strUserName, InStr(strUserName, Chr$(0)) - 1)
    MsgBox "Hello " + strUserName
    End Sub






  3. #3
    Join Date
    Jul 2001
    Posts
    23

    Re: Getting User Info

    This i already got.
    Actually i want the various data specified in the type definition


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured