简体   繁体   English

C ++检查是否有任何用户登录Windows 7

[英]C++ check if any user is logged in to windows 7

I use psexec to run my app, Some of the tasks my app does should have a logged on user, so I want to check (from the app, not the server which runs the psexec) if there is a user which currently logged on. 我使用psexec运行我的应用程序,我的应用程序确实执行的某些任务应该有一个登录用户,因此我想(从应用程序,而不是运行psexec的服务器)检查是否有当前登录的用户。 I couldn't find any api which retrieve this. 我找不到任何检索此的api。 My code is in c++. 我的代码在c ++中。 Any idea to check it? 有想法检查吗?

Found a solution to this issue I enumerate the registry keys (using RegEnumKeyEx) under HKEY_USERS. 找到了解决此问题的方法,我列举了HKEY_USERS下的注册表项(使用RegEnumKeyEx)。 If there is a key different from the default ones (".DEFAULT","S-1-5-18","S-1-5-19","S-1-5-20") it means that at least on user is logged on 如果存在与默认密钥不同的密钥(“ .DEFAULT”,“ S-1-5-18”,“ S-1-5-19”,“ S-1-5-20”),则表示最少用户登录

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM