Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我想以交互模式以编程方式登录另一个 Windows 用户。我已经创建了新的 Windows 用户帐户,并且想在没有用户交互的情况下将系统切换到该帐户。
您能否指点我一些 API 命令或 MSDN 页面?谢谢
看起来 WTSConnectSession 是正确的方向
如果您不是在谈论终端服务器会话,那么如果您以该用户身份登录,则需要 LogonUser(),如果您想以已经登录的用户身份执行某些操作,则需要 ImpersonateLoggedOnUser()。两者都可以在 Advapi32.lib 中找到。