如何从Windows注册表中查找登录用户? [英] How to find logged in user from Windows Registry?
本文介绍了如何从Windows注册表中查找登录用户?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
正在使用C#和xaml开发一个Windows应用商店8.1应用。
In我的应用程序我想从Windows注册表中找到登录的用户名。
如何从C#代码中获取?
任何人都可以帮助我。
问候,
Santhosh
解决方案
它与注册表无关...
你能做的就是获取当前运行应用程序的用户的用户名...
使用 WindowsIdentity [ ^ ]:
string szUser = System.Security 。.Principal.WindowsIdentity.GetCurrent()名称;
您可以在Windows 7中找到当前登录的用户@ \\\ HKEY_CURRENT_USER \Volatile Environment \USERNAME。
请检查以下链接以获取更多详细信息
当前登录用户的注册表项 [ ^ ]
Hi,
am developing a windows store 8.1 app using C# and xaml.
In my app i want to find logged in user name from Windows Registry.
How can i get that from C# code?
Anybody please help me.
Regards,
Santhosh解决方案It has nothing to do with the registry...
What you can do is get the username for the user currently running the application...
Use WindowsIdentity[^] for that:
string szUser = System.Security.Principal.WindowsIdentity.GetCurrent().Name;
You can find the current logged in user @\HKEY_CURRENT_USER\Volatile Environment\USERNAME in Windows 7.
Please check below link for additional details
Registry key for the currently logged in user[^]
这篇关于如何从Windows注册表中查找登录用户?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文