1. Dawn Browneyes
  2. PowerBuilder
  3. Wednesday, 18 May 2022 17:14 PM UTC

How can I tell if PB is running in Citrix VS the desktop?   I have a popup window displayed in the lower right corner and I want it to move around when the MAIN FRAME window resizes.   It works great on my desktop but when it is deployed to Citrix it is partially off the screen.  Thank you!

Accepted Answer
Chris Pollach @Appeon Accepted Answer Pending Moderation
  1. Wednesday, 18 May 2022 18:07 PM UTC
  2. PowerBuilder
  3. # Permalink

Hi Dawn;

  FWIW: I do that in my STD Framework for the App's default INI file ... for example:

Ciitrix=YES/NO

Basically a KISS implementation but an easy thing to do & set in the INI during Citrix deployment.  ;-)

Food for thought. HTH

Regards ... Chris

Comment
There are no comments made yet.
John Fauss Accepted Answer Pending Moderation
  1. Wednesday, 18 May 2022 19:44 PM UTC
  2. PowerBuilder
  3. # 1

I found the following technique in a Visual Basic question in StackOverflow and adapted it for PB:

// Global Function f_IsSessionType(String as_session_type) returns Boolean

// Where as_session_type is any one of the following values (case does not matter):
//   Citrix          or  Citrix Server
//   Remote Desktop  or  Terminal Server
//   Console         or  PC

Integer li_rc, li_num_values
String  ls_values[]
ContextKeyword lcx_keyword

// Argument validation...
If IsNull(as_session_type) Then Return False
as_session_type = Lower(Trim(as_session_type))
If as_session_type = "" Then Return False

// Request a context service object...
li_rc = GetContextService("ContextKeyword",lcx_keyword)
If li_rc = 1 Then
   // Request the value of the SessionName environment variable...
   li_num_values = lcx_keyword.GetContextKeywords("SessionName",ls_values)
   If li_num_values > 0 Then
      // We're only interested in the first three characters of the first response value.
      ls_values[1] = Mid(Upper(ls_values[1]),1,3)
      // Is this a Citrix session?
      If as_session_type = "citrix" Or as_session_type = "citrix server" Then
         Return (ls_values[1] = "ICA")
      // Is this a Remote Desktop session?
      ElseIf as_session_type = "remote desktop" Or as_session_type = "terminal server" Then
         Return (ls_values[1] = "RDP")
      // Is this a Console (i.e., a PC) session?
      ElseIf as_session_type = "console" Or as_session_type = "pc" Then
         Return (ls_values[1] = "CON")
      Else
         Return False
      End If
   End If
End If

Return False

Disclaimer: I do not have access to a Citrix server or easy access to a Remote Desktop that I can install and test this function. It does however, recognize a PC/Console session. Please test it thoroughly.

Perhaps this will give you what you want without having to add and remember to configure an INI-file entry.

Best regards, John

Comment
  1. Olan Knight
  2. Thursday, 19 May 2022 14:36 PM UTC
That's a great solution! Thanks for sharing this!
  1. Helpful
There are no comments made yet.
  • Page :
  • 1


There are no replies made for this question yet.
However, you are not allowed to reply to this question.