C# window xp current user when using run as

半世苍凉 提交于 2020-01-26 03:21:07

问题


Is there any way to get the current user who used the run as command to run my applcation on windows xp? I have an application that must be run as an administrator but I need to be able to tell the user who started the application for putting short cuts on their desktop.

I have tried environment.getcurrentuser() and even doing a direct called to the windows api but unfortunately those only tell me the owner of the thread and not the currently logged in user.


回答1:


The work around that I used was to place short cuts on the public desktop so everyone gets it. Basically I was hoping for a way around just using the public desktop. I am going to go ahead and put this down as the answer but if anyone else comes up with a solution I will mark it as the answer.



来源:https://stackoverflow.com/questions/21641707/c-sharp-window-xp-current-user-when-using-run-as

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!