Results 1 to 4 of 4

Thread: User Accounts List

  1. #1

    Thread Starter
    Wait... what? weirddemon's Avatar
    Join Date
    Jan 2009
    Location
    USA
    Posts
    3,826

    User Accounts List

    Does anyone know of an API that allows me to grab a list of all the Users on a PC?

    I'm creating a small application that will allow the User to focus just on the logged in account, or all accounts.

    If the User selects all accounts, I need to be able to go through all of the Users and access the appropriate directories.

    Any information is appreciated.

    Thanks
    CodeBank contributions: Process Manager, Temp File Cleaner

    Quote Originally Posted by SJWhiteley
    "game trainer" is the same as calling the act of robbing a bank "wealth redistribution"....

  2. #2
    Discovering Life Siddharth Rout's Avatar
    Join Date
    Feb 2005
    Location
    Mumbai, India
    Posts
    12,001

    Re: User Accounts List

    You don't need an API for this...

    Hope this helps...

    Code:
    Option Explicit
    
    '~~> Usage: Create a Form with a Command Button and a ListBox
    Private Sub Command1_Click()
        Dim users As String, wshShell As Object
        
        Set wshShell = CreateObject("WScript.Shell")
        
        Call wshShell.Run("cmd.exe /C" & "net user > C:\Koolsid.Txt", 0, True)
    
        Open "C:\Koolsid.Txt" For Input As #1
        
        Do Until EOF(1)
            Line Input #1, users
            List1.AddItem users
        Loop
        
        Close #1
    
        Kill "C:\Koolsid.Txt"
    End Sub
    A good exercise for the Heart is to bend down and help another up...
    Please Mark your Thread "Resolved", if the query is solved


    MyGear:
    ★ CPU ★ Ryzen 5 5800X
    ★ GPU ★ NVIDIA GeForce RTX 3080 TI Founder Edition
    ★ RAM ★ G. Skill Trident Z RGB 32GB 3600MHz
    ★ MB ★ ASUS TUF GAMING X570 (WI-FI) ATX Gaming
    ★ Storage ★ SSD SB-ROCKET-1TB + SEAGATE 2TB Barracuda IHD
    ★ Cooling ★ NOCTUA NH-D15 CHROMAX BLACK 140mm + 10 of Noctua NF-F12 PWM
    ★ PSU ★ ANTEC HCG-1000-EXTREME 1000 Watt 80 Plus Gold Fully Modular PSU
    ★ Case ★ LIAN LI PC-O11 DYNAMIC XL ROG (BLACK) (G99.O11DXL-X)
    ★ Monitor ★ LG Ultragear 27" 240Hz Gaming Monitor
    ★ Keyboard ★ TVS Electronics Gold Keyboard
    ★ Mouse ★ Logitech G502 Hero

  3. #3
    Pro Grammar chris128's Avatar
    Join Date
    Jun 2007
    Location
    England
    Posts
    7,604

    Re: User Accounts List

    You also dont need to use any external commands like that if you are using .NET (which I think weirddemon will be). Here's something I posted in the codebank a while ago that will do the trick: http://www.vbforums.com/showthread.php?t=590129
    My free .NET Windows API library (Version 2.2 Released 12/06/2011)

    Blog: cjwdev.wordpress.com
    Web: www.cjwdev.co.uk


  4. #4

    Thread Starter
    Wait... what? weirddemon's Avatar
    Join Date
    Jan 2009
    Location
    USA
    Posts
    3,826

    Re: User Accounts List

    yeah. I saw that the other day, Chris. I've never used that namespace, so I was surprised it was that easy.

    Thanks, Chris
    CodeBank contributions: Process Manager, Temp File Cleaner

    Quote Originally Posted by SJWhiteley
    "game trainer" is the same as calling the act of robbing a bank "wealth redistribution"....

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