问题解决:
function GetClientIP: String;
var
i: DWORD;
buf: PWTSClientAddress;
j: integer;
str: string;
begin
if WTSQuerySessionInformation(WTS_CURRENT_SERVER_HANDLE, WTS_CURRENT_SESSION, WTSClientAddress, pointer(buf), i) then
if buf.AddressFamily <> AF_UNSPEC then
begin
for j := 2 to 5 do
str := str + IntToStr(buf.AddRess[j]) + '.';
Result := Copy(str, 1, Length(str) - 1);
end
else
Result := '127.0.0.1';
end;