Jump to content

DosSetSession (OS/2 1.x): Difference between revisions

From EDM2
Created page with "==Description== This call sets the status of a child session. ==Syntax== <PRE> DosSetSession (SessID, StatusData) </PRE> ==Parameters== ; SessID (USHORT) - input : ID o..."
 
Ak120 (talk | contribs)
mNo edit summary
 
(4 intermediate revisions by 2 users not shown)
Line 1: Line 1:
==Description==
This call sets the status of a child session.
This call sets the status of a child session.


==Syntax==
==Syntax==
<PRE>
  DosSetSession (SessID, StatusData)
  DosSetSession


    (SessID, StatusData)
</PRE>
==Parameters==
==Parameters==
; SessID (USHORT) - input : ID of the target session. The value specified for SessID must have been returned on a prior call to DosStartSession.  
;SessID (USHORT) - input : ID of the target session. The value specified for SessID must have been returned on a prior call to DosStartSession.
 
;StatusData (P[[STATUSDATA]]) - input : Address of the session status data structure
; StatusData (PSTATUSDATA) - input : Address of the session status data structure:
 
length (USHORT) : Length of structure, including length.
 
Only valid value.
 
selectind (USHORT): Specifies whether the target session is flagged as selectable or non-selectable: The operator can continue to select a non-selectable (bonded) windowed session by pressing a mouse button within a visible part of the window.
 
Value            Definition
0            Leave current setting unchanged.
1            Selectable.
2            Non-selectable.
 
bondind (USHORT) : Specifies which session to bring to the foreground the next time the parent session is selected. The operator may continue to select a non-selectable (bonded) windowed session by pressing a mouse button within a visible part of the window.
 
Value                Definition
0                Leave current setting unchanged.
1                Establish a bond between parent session and child session. The child session is brought
                  to the foreground the next time the parent session is selected, or when the child session
                  itself is selected.
2                Bring either the parent session to the foreground the next time the
                  parent session is selected, or the child session if the child session is selected.
                  Any bond previously established with a child session is broken.


==Return Code==
==Return Code==
rc (USHORT) - return
;rc (USHORT) - return:Return code descriptions are:
 
* 0 NO_ERROR
Return code descriptions are:
*369 ERROR_SMG_INVALID_SESSION_ID
 
*418 ERROR_SMG_INVALID_CALL
* 0         NO_ERROR  
*452 ERROR_SMG_SESSION_NOT_PARENT
* 369       ERROR_SMG_INVALID_SESSION_ID  
*455 ERROR_SMG_INVALID_BOND_OPTION
* 418       ERROR_SMG_INVALID_CALL  
*456 ERROR_SMG_INVALID_SELECT_OPT
* 452       ERROR_SMG_SESSION_NOT_PARENT  
*461 ERROR_SMG_INVALID_DATA_LENGTH
* 455       ERROR_SMG_INVALID_BOND_OPTION  
* 456       ERROR_SMG_INVALID_SELECT_OPT  
* 461       ERROR_SMG_INVALID_DATA_LENGTH


==Remarks==
==Remarks==
DosSetSession sets one or both of the following structure elements related to a child session. The elements can be set individually by the parent session, and either one can be changed without affecting the current setting of the other:
DosSetSession sets one or both of the following structure elements related to a child session. The elements can be set individually by the parent session, and either one can be changed without affecting the current setting of the other:
 
;selectind : Sets the child session selectable or non-selectable.
; selectind : Sets the child session selectable or non-selectable.  
;bondind : Bonds the child session to the parent session. If the operator selects the parent session from the Task Manager, the child session is brought to the foreground.
 
; bondind : Bonds the child session to the parent session. If the operator selects the parent session from the Task Manager, the child session is brought to the foreground.  


These elements only affect selections made by the operator from the switch list, not selections made by the parent session. When a parent session selects its own session, the parent session is brought to the foreground even if a bond is in effect. When a parent session selects a child session, the child session is brought to the foreground even if the parent session had set the child session to be non-selectable.
These elements only affect selections made by the operator from the switch list, not selections made by the parent session. When a parent session selects its own session, the parent session is brought to the foreground even if a bond is in effect. When a parent session selects a child session, the child session is brought to the foreground even if the parent session had set the child session to be non-selectable.
Line 61: Line 29:
A bond established between a parent session and a child session can be broken by reissuing DosSetSession and specifying either:
A bond established between a parent session and a child session can be broken by reissuing DosSetSession and specifying either:


; bondind = 2 : Breaks the bond between the parent session and the child session.  
;bondind = 2 : Breaks the bond between the parent session and the child session.
 
;bondind = 1 : Establishes a bond with a different child session. In this case the bond with the previous child session is broken.
; bondind = 1 : Establishes a bond with a different child session. In this case the bond with the previous child session is broken.  


Assume a bond is established between session A and its immediate child session B. Assume another bond is established between session B and its immediate child session C. Now if the operator selects session A, session C is brought to the foreground. However, if session A selects its own session, session A is brought to the foreground. If session A selects session B, session C is brought to the foreground. In the latter case, the bond between B and C is honored.
Assume a bond is established between session A and its immediate child session B. Assume another bond is established between session B and its immediate child session C. Now if the operator selects session A, session C is brought to the foreground. However, if session A selects its own session, session A is brought to the foreground. If session A selects session B, session C is brought to the foreground. In the latter case, the bond between B and C is honored.
Line 69: Line 36:
Assume a bond is established between session A and its immediate child session B, and assume B is non-selectable. The operator cannot select session B directly. However, if the operator selects session A, session B is brought to the foreground.
Assume a bond is established between session A and its immediate child session B, and assume B is non-selectable. The operator cannot select session B directly. However, if the operator selects session A, session B is brought to the foreground.


A parent session can run in either the foreground or background when DosSetSession is issued.  
A parent session can run in either the foreground or background when DosSetSession is issued.


 
==Binding==
==Example Code==
===C===
===C Binding===
<PRE>
<PRE>
typedef struct _STATUSDATA {  /* stsdata */
typedef struct _STATUSDATA {  /* stsdata */
Line 94: Line 60:
</PRE>
</PRE>


===MASM Binding===
===MASM===
<PRE>
<PRE>
STATUSDATA struc
STATUSDATA struc
   stsdata_Length    dw  ? ;length of this data structure
   stsdata_Length    dw  ? ;length of this data structure
   stsdata_SelectInd dw  ? ;0=leave setting unchanged, 1=selectable
   stsdata_SelectInd dw  ? ;0=leave setting unchanged, 1=selectable
                             ;2=non-selectable
                             ;2=non-selectable
   stsdata_BindInd  dw  ? ;which session to bring to foreground
   stsdata_BindInd  dw  ? ;which session to bring to foreground
STATUSDATA ends
STATUSDATA ends


Line 114: Line 78:
Returns WORD
Returns WORD
</PRE>
</PRE>
==Related Functions==
*


[[Category:The OS/2 API Project]]
[[Category:Dos16]]

Latest revision as of 07:02, 26 January 2020

This call sets the status of a child session.

Syntax

DosSetSession (SessID, StatusData)

Parameters

SessID (USHORT) - input
ID of the target session. The value specified for SessID must have been returned on a prior call to DosStartSession.
StatusData (PSTATUSDATA) - input
Address of the session status data structure

Return Code

rc (USHORT) - return
Return code descriptions are:
  • 0 NO_ERROR
  • 369 ERROR_SMG_INVALID_SESSION_ID
  • 418 ERROR_SMG_INVALID_CALL
  • 452 ERROR_SMG_SESSION_NOT_PARENT
  • 455 ERROR_SMG_INVALID_BOND_OPTION
  • 456 ERROR_SMG_INVALID_SELECT_OPT
  • 461 ERROR_SMG_INVALID_DATA_LENGTH

Remarks

DosSetSession sets one or both of the following structure elements related to a child session. The elements can be set individually by the parent session, and either one can be changed without affecting the current setting of the other:

selectind
Sets the child session selectable or non-selectable.
bondind
Bonds the child session to the parent session. If the operator selects the parent session from the Task Manager, the child session is brought to the foreground.

These elements only affect selections made by the operator from the switch list, not selections made by the parent session. When a parent session selects its own session, the parent session is brought to the foreground even if a bond is in effect. When a parent session selects a child session, the child session is brought to the foreground even if the parent session had set the child session to be non-selectable.

DosSetSession may be issued by a process only for a child session it started with a DosStartSession request, specifying Related=1. Neither the parent session nor any grandchild session may be the target of DosSetSession.

A bond established between a parent session and a child session can be broken by reissuing DosSetSession and specifying either:

bondind = 2
Breaks the bond between the parent session and the child session.
bondind = 1
Establishes a bond with a different child session. In this case the bond with the previous child session is broken.

Assume a bond is established between session A and its immediate child session B. Assume another bond is established between session B and its immediate child session C. Now if the operator selects session A, session C is brought to the foreground. However, if session A selects its own session, session A is brought to the foreground. If session A selects session B, session C is brought to the foreground. In the latter case, the bond between B and C is honored.

Assume a bond is established between session A and its immediate child session B, and assume B is non-selectable. The operator cannot select session B directly. However, if the operator selects session A, session B is brought to the foreground.

A parent session can run in either the foreground or background when DosSetSession is issued.

Binding

C

typedef struct _STATUSDATA {   /* stsdata */
 
  USHORT Length;               /* length of this data structure */
  USHORT SelectInd;            /* 0=leave setting unchanged, 1=selectable
                                    2=non-selectable */
  USHORT BondInd;              /* which session to bring to foreground */
 
} STATUSDATA;

#define INCL_DOSSESMGR

USHORT  rc = DosSetSession(SessID, StatusData);

USHORT           SessID;        /* Session ID */
PSTATUSDATA      StatusData;    /* Session status data */

USHORT           rc;            /* return code */

MASM

STATUSDATA struc
  stsdata_Length    dw  ? ;length of this data structure
  stsdata_SelectInd dw  ? ;0=leave setting unchanged, 1=selectable
                             ;2=non-selectable
  stsdata_BindInd   dw  ? ;which session to bring to foreground
STATUSDATA ends

EXTRN  DosSetSession:FAR
INCL_DOSSESMGR      EQU 1

PUSH   WORD    SessID        ;Session ID
PUSH@  OTHER   StatusData    ;Session status data
CALL   DosSetSession

Returns WORD