Black screen in Citrix with PowerBuilder 2017

Symptom With PB2017, it shows black screen when it comes processing large number of database records or when it’s about more time to fetch the DataWindow rows. In earlier version it used to show hour glass or 'Not Responding' which was a better user experience compared to black screen.

Environment

PowerBuilder 2017, 2019, 2021

Citrix Server & RDP

Windows 10

Cause

  1. When reading a large amount of data in a loop or it takes a long time for a DataWindow to retrieve data, Windows will mark the associated window as not responding.

    Windows marks a window as unresponsive if the UI thread doesn't receive messages for more than 5 seconds. A way to avoid unresponsive windows altogether would be using shared objects to run long-running loops or database retrieves in a separate thread.

  2. Theme is enabled for the current application.

Solution

  1. Use DisableProcessWindowsGhosting API to work around this issue.

    It’s easy to turn ghosting off. A simple Windows API function does the trick. Here’s the PowerBuilder external function declaration (EFD):

    SUBROUTINE DisableProcessWindowsGhosting ( ) LIBRARY "user32.dll"

    Once the EFD has been saved in a window or user object, simply call that function from within the object:

    DisableProcessWindowsGhosting()
  2. Disable theme.