C# 获得系统所有用户和当前登录用户(当前进程的)
代码说明:
using System; using System.Collections.Generic; using System.Runtime.InteropServices; using System.Security.Principal; using System.Text; namespace SystemUsers { class Program { [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)] public struct USER_INFO_0 { public string UserName; } [DllImport("Netapi32.dll")] extern static int NetUserEnum( [MarshalAs(UnmanagedType.LPWStr)]
下载说明:请别用迅雷下载,失败请重下,重下不扣分!