Terminal server session

Post Reply
User avatar
AlexSchaft
Posts: 172
Joined: Fri Oct 07, 2005 1:29 pm
Location: Edenvale, Gauteng, South Africa

Terminal server session

Post 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
User avatar
James Bott
Posts: 4654
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA
Contact:

Post 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
Gale FORd
Posts: 663
Joined: Mon Dec 05, 2005 11:22 pm
Location: Houston
Contact:

Post by Gale FORd »

In xHarbour

IF OS_ISWTSCLIENT()
? "Running as a Windows Terminal Server Client"
ELSE
? "NO Windows Terminal Server Client detected"
ENDIF
User avatar
Enrico Maria Giordano
Posts: 7355
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia
Contact:

Post 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
Gale FORd
Posts: 663
Joined: Mon Dec 05, 2005 11:22 pm
Location: Houston
Contact:

Post 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
User avatar
Enrico Maria Giordano
Posts: 7355
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia
Contact:

Post by Enrico Maria Giordano »

Sorry, my fault! I missed the real definition in the same source code.

I apologize.

EMG
User avatar
AlexSchaft
Posts: 172
Joined: Fri Oct 07, 2005 1:29 pm
Location: Edenvale, Gauteng, South Africa

Terminal server

Post 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
User avatar
AlexSchaft
Posts: 172
Joined: Fri Oct 07, 2005 1:29 pm
Location: Edenvale, Gauteng, South Africa

Detect terminal server session alternative

Post by AlexSchaft »

#define SM_REMOTESESSION 4096

IF GetSysMetrics( SM_REMOTESESSION ) <> 0
MsgAlert("On a Remote TS Session")
endif
User avatar
concentra
Posts: 107
Joined: Mon Nov 14, 2005 10:15 am
Location: Brazil

Post by concentra »

Davide, did you have success in getting the IP address of the TS client ?

Maurício Faria
Post Reply