Winform切换登录用户
///本来是打算像bs软件那样重新写个小形的登录窗口出来的,但是cs涉及权限问题比较难管理,所以就在网上找到了这个关闭程序再开的方法,属实好用。
/// <summary> /// 退出登录 /// </summary> public static void ReLoign() { Application.ExitThread(); Thread thtmp = new Thread(new ParameterizedThreadStart(Run)); object appName = Application.ExecutablePath; Thread.Sleep(1); thtmp.Start(appName); } private static void Run(Object appName) { Process ps = new Process { StartInfo = new ProcessStartInfo { FileName = appName.ToString() } }; ps.Start(); }
转载自:https://blog.csdn.net/xiaoyong_net/article/details/72983945