Code to determine if the VB6 App isrunning under a Terminal Server Session
Code:
Private Const SM_REMOTESESSION = &H1000
Private Const SM_REMOTECONTROL = &H2001
Private Declare Function GetSystemMetrics Lib "user32" (ByVal nIndex As Long) As Long
Public Function Is_TerminalServer() As Boolean
' #VBIDEUtils#************************************************************
' * Author :
' * Web Site :
' * E-Mail :
' * Date : 08/19/2011
' * Time : 12:58
' * Module Name : Lib_Module
' * Module Filename : Lib.bas
' * Procedure Name : Is_TerminalServer
' * Purpose :
' * Parameters :
' * Purpose :
' **********************************************************************
' * Comments :
' *
' *
' * Example :
' *
' * See Also :
' *
' * History :
' *
' *
' **********************************************************************
' #VBIDEUtilsERROR#
On Error GoTo ERROR_Is_TerminalServer
If GetSystemMetrics(SM_REMOTESESSION) > 0 Then
Is_TerminalServer = True
Else
Is_TerminalServer = False
End If
EXIT_Is_TerminalServer:
On Error Resume Next
Exit Function
' #VBIDEUtilsERROR#
ERROR_Is_TerminalServer:
Resume EXIT_Is_TerminalServer
End Function