If we use the GetUserName function, it will return SYSTEM since this is running as a system application. So, is there a way for an application running as a system process to get the login ID / username of the currently logged-on user?
System Process : Get currently logged on user?Run app as system process but still get logged-on user
Page 1 of 1
5 Replies - 2908 Views - Last Post: 14 October 2010 - 08:16 PM
#1
System Process : Get currently logged on user?
Posted 14 October 2010 - 03:09 AM
We have a small windows application that we need to run as a system process. However, somewhere in the application code, we need to get the login ID of the currently logged on user.
If we use the GetUserName function, it will return SYSTEM since this is running as a system application. So, is there a way for an application running as a system process to get the login ID / username of the currently logged-on user?
If we use the GetUserName function, it will return SYSTEM since this is running as a system application. So, is there a way for an application running as a system process to get the login ID / username of the currently logged-on user?
Replies To: System Process : Get currently logged on user?
#2
Re: System Process : Get currently logged on user?
Posted 14 October 2010 - 03:13 AM
You can use the Windows API function GetUserName()
#3
Re: System Process : Get currently logged on user?
Posted 14 October 2010 - 06:13 AM
kercher, on 14 October 2010 - 04:09 AM, said:
We have a small windows application that we need to run as a system process. However, somewhere in the application code, we need to get the login ID of the currently logged on user.
If we use the GetUserName function, it will return SYSTEM since this is running as a system application. So, is there a way for an application running as a system process to get the login ID / username of the currently logged-on user?
If we use the GetUserName function, it will return SYSTEM since this is running as a system application. So, is there a way for an application running as a system process to get the login ID / username of the currently logged-on user?
Debug.Print Environ("UserName")
Research the Environ function, very useful.
#4
Re: System Process : Get currently logged on user?
Posted 14 October 2010 - 07:53 PM
Environ("UserName") return blank when the application is run as a system process
#5
Re: System Process : Get currently logged on user?
Posted 14 October 2010 - 08:16 PM
no2pencil, on 14 October 2010 - 02:13 AM, said:
You can use the Windows API function GetUserName()
Quote
If we use the GetUserName function, it will return SYSTEM since this is running as a system application.
we do use the GetUserName function but it returns the login name of the user that the application is running as, not necessarily the currently logged-in user
#6
Re: System Process : Get currently logged on user?
Posted 14 October 2010 - 08:16 PM
Page 1 of 1
|
|

New Topic/Question
Reply




MultiQuote




|