Phenomenon
Opening a window with the new RTE control over Terminal Services is very slow.
Scenario 1
Published PowerBuilder RemoteApp over Terminal Services.
-
Allow client printer redirection.
-
Use the client default printing device.
-
Use the Remote Desktop Easy Print print driver first.
-
Open a PowerBuilder Application.
-
Open a window that has the new RTE control.
Scenario 2
Access a Remote Desktop that has the PowerBuilder Application installed.
-
Open Remote Desktop.
-
Open a PowerBuilder Application.
-
Open a window that has the new RTE control.
Workaround 1
-
Open Server Manager.
-
Select "Remote Desktop Services".
-
Select the Collection where your application has been published.
-
On the "Properties" section, Click on the "Tasks" dropdown.
-
Choose "Edit Properties".
-
Expand the "Client Settings".
-
De-select the checkbox for "Use the client default printing device" option.
Workaround 2
On the PowerBuilder application:
-
Delete the RichTextEdit Control from the window.
-
Add Functions:
Global External Functions
FUNCTION ULong GetDefaultPrinterW(REF String pszBuffer, REF ULong pcchBuffer) LIBRARY "winspool.drv" ALIAS FOR "GetDefaultPrinterW" FUNCTION ULong SetDefaultPrinterW(String pszPrinter) LIBRARY "winspool.drv" ALIAS FOR "SetDefaultPrinterW"
-
Add Instance Variables:
Instance Variables
STRING is_fullstring, is_default STRING is_name, is_driver, is_port, is_temp, is_new LONG il_place
-
Add code to the Open event of your window:
Open Event
//Maximize the Window WindowState = Maximized! //Trigger the PreOpen Event TriggerEvent("ue_preopen") //Trigger the PostOpen Event PostEvent("ue_postopen")
-
Add code to the PreOpen User Event:
ue_PreOpen
//Variable Declaration STRING ls_null ULONG lul_buffer //Get the Current Printer info is_fullstring = PrintGetPrinter() il_place = POS(is_fullstring, "~t") is_name = LEFT(is_fullstring, il_place - 1) is_temp = MID(is_fullstring, il_place + 1) il_place = POS(is_temp, "~t") is_driver = LEFT(is_temp, il_place - 1) is_port = MID(is_temp, il_place + 1) //Clear buffers SetNull(ls_null) lul_buffer = 0 GetDefaultPrinterW(ls_null, lul_buffer) is_default = SPACE(lul_buffer) //Get OS default Printer GetDefaultPrinterW(is_default, lul_buffer) //Check if the current printer has been redirected IF POS(is_name, "redirected") > 0 THEN //Set OS default Printer SetDefaultPrinterW("Microsoft XPS Document Writer") //Change the Printer PrintSetPrinter("Microsoft XPS Document Writer") END IF
-
Add code to the PostOpen User Event:
ue_PostOpen
//Variable Declaration RichTextEdit rte_control //Create the Object rte_control = CREATE RichTextEdit //Set the X, Y, Width and Height properties of the Object rte_control.x = 46 rte_control.y = 100 rte_control.Width = 1678 rte_control.Height = 1116 //Open the User Object OpenUserObjectWithParm(rte_control, "", 46, 100) //Bring the RTE to the Top rte_control.BringToTop = TRUE //Set the OS Default Printer SetDefaultPrinterW(is_default) //Set the Previous Printer PrintSetPrinter(is_name)
This allows the window to open and creates the RTE Control after finishing opening the window.