Problem:
You might be using dsrunner with more than one ScreenSet.
When you minimize the second one, and try to reactivate it by the dsrunner function "SWCH",
the minimized ScreenSet does not get reactivated and remains in the task bar.
Resolution:
It is possible to get back a minimized window by a USER-EVENT posted from one ScreenSet to the other.
Before you can do so, you have to transfer the WINDOW-HANDLE via a DSRUNNER shared memory area.
The ScreenSet receiving the USER-EVENT, can do a RESTORE-WINDOW and a SET-FOCUS.
The attached sample is a modified version of the DDESAMPL provied with Net Express
The followng modifications were made:
---------------------------
In every ScreenSet:
- Add to the data blocks, immediately after the last DSRUNNER variable "DSRUNNER-PARAM-STRING"
HWND-SAMPL C5 4.0
HWND-SRVR C5 4.0
HWND-CLNT C5 4.0
---------------------------
In the DDESAMPLE ScreenSet:
- In the global dialog in "SCREENSET-INITIALIZED" allocate the DSRUNNER shared memory area
MOVE 12 DSRUNNER-PARAM-NUMERIC(1)
MOVE "ALOC" DSRUNNER-FUNCTION-CODE(1)
RETC
- Ensure, that the user events are only posted, when the window was created
MOVE 0 HWND-SRVR(1)
MOVE 12 DSRUNNER-PARAM-NUMERIC(1)
MOVE "to" DSRUNNER-FUNCTION-CODE(1)
RETC
- Add a button "~Reactivate" to the DDESAMPLE.GS
- Add as dialog of the new button:
BUTTON-SELECTED
MOVE 12 DSRUNNER-PARAM-NUMERIC(1)
MOVE "FROM" DSRUNNER-FUNCTION-CODE(1)
RETC
IFNOT= 0 HWND-SRVR(1) DO-THE-SWITCH
DO-THE-SWITCH
POST-USER-EVENT HWND-SRVR(1) 44001 $NULL
MOVE "ddesrvr" DSRUNNER-PARAM-STRING(1)
MOVE "SWCH" DSRUNNER-FUNCTION-CODE(1)
RETC
---------------------------
In the DDESRVR ScreenSet:
- In the dialog of the DDE-MAIN window, update the DSRUNNER shared memory area
WINDOW-CREATED
MOVE 12 DSRUNNER-PARAM-NUMERIC(1)
MOVE "FROM" DSRUNNER-FUNCTION-CODE(1)
RETC
MOVE-OBJECT-HANDLE DDE-MAIN HWND-SRVR(1)
MOVE 12 DSRUNNER-PARAM-NUMERIC(1)
MOVE "TO" DSRUNNER-FUNCTION-CODE(1)
RETC
MOVE 12 DSRUNNER-PARAM-NUMERIC(1)
MOVE "FROM" DSRUNNER-FUNCTION-CODE(1)
RETC
MOVE 0 HWND-SRVR(1)
MOVE 12 DSRUNNER-PARAM-NUMERIC(1)
MOVE "TO" DSRUNNER-FUNCTION-CODE(1)
RETC
*
USER-EVENT
XIF= $EVENT-DATA 54321 HANDLE-DDE-EVENT
XIF= $EVENT-DATA 44001 SET-MY-FOCUS
SET-MY-FOCUS
RESTORE-WINDOW DDE-MAIN
SET-FOCUS DDE-MAIN
- In the global dialog, there is an existing CLOSE-WINDOW event handling
- Remove the handle before destroying the ScreenSet to prevent to reactivate of a non-existing window
CLOSED-WINDOW
MOVE 12 DSRUNNER-PARAM-NUMERIC(1)
MOVE "FROM" DSRUNNER-FUNCTION-CODE(1)
RETC
MOVE 0 HWND-SRVR(1)
MOVE 12 DSRUNNER-PARAM-NUMERIC(1)
MOVE "TO" DSRUNNER-FUNCTION-CODE(1)
RETC
*
---------------------------
Run the demo:
- Start the demo
- on the DDESAMPLE.gs main window, click on Server
- the DDESRVR.gs main window appears, minimze the window
- on the DDESAMPLE.gs main window, click on Reactivate
- the DDESRVR.gs main window is restored



