-
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
-
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
-
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
-
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