Page 1 of 1
Terminal server session
Posted: Mon Jun 05, 2006 6:59 am
by AlexSchaft
Hi,
A while back (on the fw news groups), I asked about detecting terminal server sessions.
I got an answer, which I've now lost, and I can't seem to connect to the news server anymore (Is there a browsable backup)
So I'm asking again: How can I detect whether I'm in a terminal server session?
Alex
Posted: Mon Jun 12, 2006 4:18 pm
by James Bott
Alex,
I searched all my offline copies of the old forums for both "terminal" and "Alex" and I couldn't find anything. However, my copies are not complete. Sorry I couldn't be of any help.
James
Posted: Mon Jun 12, 2006 8:01 pm
by Gale FORd
In xHarbour
IF OS_ISWTSCLIENT()
? "Running as a Windows Terminal Server Client"
ELSE
? "NO Windows Terminal Server Client detected"
ENDIF
Posted: Mon Jun 12, 2006 9:33 pm
by Enrico Maria Giordano
Sorry but it seems that the only occurrence of OS_ISWTSCLIENT() in che current xHarbour CVS is
Code: Select all
FUNCTION OS_ISWTSCLIENT()
RETURN( .F. )
EMG
Posted: Mon Jun 12, 2006 11:13 pm
by Gale FORd
Enrico,
Were you responding to me?
I am using this funcion in xHarbour Builder with and without Fivewin.
Our configuration include Citrix and Lan users.
Thanks,
Gale
Posted: Tue Jun 13, 2006 9:03 am
by Enrico Maria Giordano
Sorry, my fault! I missed the real definition in the same source code.
I apologize.
EMG
Terminal server
Posted: Wed Jun 14, 2006 2:38 am
by AlexSchaft
Hi,
Thanks for that.
I'm also trying out WTSQuerySessionInformation for the client's ip address, but dont' seem to come right (c is not my strong point).
Below a snippet of my attempt.
#pragma begindump
#include <WinTen.h>
#include <Windows.h>
#include <ClipApi.h>
#ifdef __FLAT__
#include <ShellApi.h>
#endif
#ifdef __HARBOUR__
#include <hbapiitm.h>
#include <hbdate.h>
#include <hbset.h>
#endif
#include "wtsapi32.h"
LPWSTR AnsiToWide( char * );
HB_FUNC( GETIPADDRESS )
{
BOOL bReturn;
WTS_CLIENT_ADDRESS *ClientAddress;
DWORD BytesReturned;
bReturn = WTSQuerySessionInformation(WTS_CURRENT_SERVER_HANDLE, WTS_CURRENT_SESSION, 16384, (char * *) ClientAddress, &BytesReturned);
}
#pragma enddump
Detect terminal server session alternative
Posted: Wed Jun 21, 2006 7:14 am
by AlexSchaft
#define SM_REMOTESESSION 4096
IF GetSysMetrics( SM_REMOTESESSION ) <> 0
MsgAlert("On a Remote TS Session")
endif
Posted: Sat Jan 13, 2007 9:47 pm
by concentra
Davide, did you have success in getting the IP address of the TS client ?
MaurĂcio Faria