Источник:
http://www.axaptapedia.com/Registry_client_name
==============
Summary: New page: Having been handed a requirement to connect machines which log onto Axapta 3.0 from Terminal Services and utilize the local Windows XP client hostname, I've found the Windows Registry can ...
Having been handed a requirement to connect machines which log onto Axapta 3.0 from Terminal Services and utilize the local Windows XP client hostname, I've found the Windows Registry can provide one possible solution.
X++:
str getRegistryClientName()
{
// Get hostname from Terminal Services Session
#winAPI
int intHandle;
container clintName;
;
intHandle = WinAPI::regOpenKey(#HKEY_CURRENT_USER, 'Volatile Environment', #KEY_READ);
clintName = WinAPI::regGetValue(intHandle, 'CLIENTNAME');
WinAPI::regCloseKey(intHandle);
return conpeek(clintName,1);
}
Further into the process you might need to check the value is not of the form CONSOLE, as this would pertain to a locally logged in session, which differs in the Registry Key value. For this I found the winAPI::getComputerName() method was more reasonable.
X++:
void getHostName()
{
;
if(hostName)
return;
// assume TS session
hostName = this.getRegistryClientName();
if(STRUPR(hostName) == "CONSOLE")// local
{
hostName = winAPI::getComputerName();
}
}
Of course within the Class Declaration it would be a good idea to include the following string!
str hostName;
Источник:
http://www.axaptapedia.com/Registry_client_name