An application can use DosSetSession to establish a bond between a parent session and one of its child sessions. When the two sessions are bound, OS/2 brings the child session to the foreground when the user selects the parent session.
In the following code fragment, a parent session is bound to the child session specified by the ulSessionID parameter:
#define INCL_DOSPROCESS /* Process and thread values */ #define INCL_DOSSESMGR #include <os2.h> ULONG ulSessionID; STATUSDATA stsdata; stsdata.Length = sizeof(stsdata); stsdata.SelectInd = SET_SESSION_UNCHANGED; /* Leaves select setting alone */ stsdata.BondInd = SET_SESSION_BOND; /* Binds parent and child */ DosSetSession(ulSessionID, &stsdata);
When the application uses DosSetSession to establish a parent-child bond, any bond the parent has with another child session is broken. The application can remove the parent-child bond by calling DosSetSession with the BondInd field (in the STATUSDATA structure) set to SET_SESSION_NO_BOND.
A parent session can be executing in either the foreground or the background when it calls DosSetSession.