【问题标题】:Show the SwitchUser Screen显示 SwitchUser 屏幕
【发布时间】:2012-12-29 08:45:57
【问题描述】:

我正在开发一个应用程序来定制 Windows 7 的切换用户和登录屏幕。

我的应用程序是作为向导构建的,在最后一步中,我希望用户能够通过按下按钮来查看切换用户屏幕,就像他/她在开始菜单中所做的那样:

【问题讨论】:

  • 我认为this 是您所需要的。
  • @Bowen,把它写下来作为我标记它的答案;)

标签: c# windows winforms customization user-customization


【解决方案1】:

提自Shortcut to Switch User in Windows Vista

using System;
using System.Runtime.InteropServices;
using System.ComponentModel;

class Program
{
  [DllImport("wtsapi32.dll", SetLastError = true)]
  static extern bool WTSDisconnectSession(IntPtr hServer, int sessionId, bool bWait);

  const int WTS_CURRENT_SESSION = -1;
  static readonly IntPtr WTS_CURRENT_SERVER_HANDLE = IntPtr.Zero;

  static void Main(string[] args)
  {
    if (!WTSDisconnectSession(WTS_CURRENT_SERVER_HANDLE,
         WTS_CURRENT_SESSION, false))
      throw new Win32Exception();
  }
}

【讨论】:

    猜你喜欢
    • 2021-10-27
    • 1970-01-01
    • 1970-01-01
    • 2015-08-07
    • 1970-01-01
    • 2017-02-16
    • 2018-05-18
    相关资源
    最近更新 更多