*-------------------------------------------------------------------------- function do_it() local SessionId, ClientName, ClientIpAddress ?GetClientInfo(@SessionId, @ClientName, @ClientIpAddress ) ?'SessionId: ', SessionId ?'ClientName: ', ClientName ?'ClientIpAddress: ', ClientIpAddress endfunc *-------------------------------------------------------------------------- function GetClientInfo(SessionId, ClientName, ClientIpAddress ) #define WTS_CURRENT_SERVER_HANDLE (0) #define WTS_CURRENT_SESSION (-1) #define WTSSessionId (4) #define WTSClientName (10) #define WTSClientAddress (14) #ifndef AF_INET #define AF_INET 2 #endif declare integer WTSQuerySessionInformation in Wtsapi32.dll ; integer hServer, ; integer SessionId, ; Integer WTSInfoClass, ; long @ ppBuffer, ; integer @pBytesReturned declare WTSFreeMemory in Wtsapi32.dll long address local ClientAddress, nBytes, sts, i ClientAddress = repl( chr(0), 4 + 20) nBytes = 0 ppBuffer = 0 && ClientIpAddress sts = WTSQuerySessionInformation( ; WTS_CURRENT_SERVER_HANDLE, ; WTS_CURRENT_SESSION, ; WTSClientAddress, ; @ppBuffer, ; @nBytes ; ) ClientIpAddress = '' do case case !empty(sts) declare RtlMoveMemory in win32api string @Dest, long Src, long BytesToCopy =RtlMoveMemory( @ClientAddress, ppBuffer, nBytes) =WTSFreeMemory( ppBuffer ) do case case left(ClientAddress,1) == chr(AF_INET) for i = 7 to 7+ 3 ClientIpAddress = ClientIpAddress + iif(empty(ClientIpAddress), '', '.') + transform(asc(substr(ClientAddress, i, 1))) endfor endcase endcase && SessionId sts = WTSQuerySessionInformation( ; WTS_CURRENT_SERVER_HANDLE, ; WTS_CURRENT_SESSION, ; WTSSessionId, ; @ppBuffer, ; @nBytes ; ) SessionId = 0 do case case !empty(sts) declare RtlMoveMemory in win32api long @Dest, long Src, long BytesToCopy =RtlMoveMemory( @SessionId , ppBuffer, 4) =WTSFreeMemory( ppBuffer ) endcase && ClientName sts = WTSQuerySessionInformation( ; WTS_CURRENT_SERVER_HANDLE, ; WTS_CURRENT_SESSION, ; WTSClientName, ; @ppBuffer, ; @nBytes ; ) ClientName = repl(chr(0), 255) do case case !empty(sts) declare RtlMoveMemory in win32api string @Dest, long Src, long BytesToCopy =RtlMoveMemory( @ClientName, ppBuffer, len(ClientName)) =WTSFreeMemory( ppBuffer ) ClientName = left(ClientName, at(chr(0), ClientName)-1) otherwise ClientName = '' endcase endfunc *-------------------------------------------------------------------------->Gregory,