FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour Terminal server session
Posts: 172
Joined: Fri Oct 07, 2005 01:29 PM
Terminal server session
Posted: Mon Jun 05, 2006 06:59 AM

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

Posts: 4840
Joined: Fri Nov 18, 2005 04:52 PM
Terminal server session
Posted: Mon Jun 12, 2006 04:18 PM

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

FWH 18.05/xHarbour 1.2.3/BCC7/Windows 10
Posts: 663
Joined: Mon Dec 05, 2005 11:22 PM
Terminal server session
Posted: Mon Jun 12, 2006 08:01 PM

In xHarbour

IF OS_ISWTSCLIENT()
? "Running as a Windows Terminal Server Client"
ELSE
? "NO Windows Terminal Server Client detected"
ENDIF

Posts: 9022
Joined: Thu Oct 06, 2005 08:17 PM
Terminal server session
Posted: Mon Jun 12, 2006 09:33 PM
Sorry but it seems that the only occurrence of OS_ISWTSCLIENT() in che current xHarbour CVS is

FUNCTION OS_ISWTSCLIENT()
  RETURN( .F. )


EMG
Posts: 663
Joined: Mon Dec 05, 2005 11:22 PM
Terminal server session
Posted: Mon Jun 12, 2006 11:13 PM

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

Posts: 9022
Joined: Thu Oct 06, 2005 08:17 PM
Terminal server session
Posted: Tue Jun 13, 2006 09:03 AM

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

I apologize.

EMG

Posts: 172
Joined: Fri Oct 07, 2005 01:29 PM
Terminal server
Posted: Wed Jun 14, 2006 02:38 AM

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

Posts: 172
Joined: Fri Oct 07, 2005 01:29 PM
Detect terminal server session alternative
Posted: Wed Jun 21, 2006 07:14 AM

define SM_REMOTESESSION 4096

IF GetSysMetrics( SM_REMOTESESSION ) <> 0
MsgAlert("On a Remote TS Session")
endif

Posts: 124
Joined: Mon Nov 14, 2005 10:15 AM
Terminal server session
Posted: Sat Jan 13, 2007 09:47 PM

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

Maurício Faria

Continue the discussion