Anatoly, thanks a lot for the links. None of them had the direct answer, but at least they offered me some hints.
>Javier, check if these code samples help > >How to enumerate sessions and processes on a specified terminal server >http://www.news2news.com/vfp/?example=519 > >WTS_SESSION_INFO returned by WTSEnumerateSessions call contains name of the WinStation for each session. > >See also: > >How to enumerate terminal servers within the specified Windows domain >http://www.news2news.com/vfp/?example=520 > >The list of servers of the specified type in the primary domain >http://www.news2news.com/vfp/?example=165 > >Using Winsock API calls, a network resource name can be resolved to ip address >Retrieving information from a host database for a given host name >http://www.news2news.com/vfp/?example=216