>>>Hi All
>>>
>>>Running an app under terminal services / remote desktop and if I use the Windows Remote desktop Services Manager and look at a logged in user I can see various info about the user such as their log in name but also the "client name" which appears to be the name of the computer that the user is using. For an example see the screenshot attached. Does anyone know an API routine to get that info from within a VFP program?
>>
>>
>>Just as an FYI for anyone interested The solution is incredibly simply and does not require accessing any API. You can retrieve the users computer name under a terminal services session simply using Windows Scripting Host in 2 lines ("doh!"):
>>
>>
>>objShell = CreateObject("WScript.Shell")
>>strClient = objShell.ExpandEnvironmentStrings("%clientname%")
>>? strClient
>>
>>
>>NB: This will only return a valid client name if it is run under a terminal services session. Otherwise you get just "%clientname%".
>
>For your information, WSH is only a wrapper around the APIs. And it's also worth noting that many companies have a policy of blocking WSH, so it's a usually better solution to use the APIs directly..
OK, thanks. We are using this on our own terminal services servers
.
In the End, we will remember not the words of our enemies, but the silence of our friends - Martin Luther King, Jr.