win12.hlp (Table of Contents; Topic list)
Important Notice
The pages on this site contain documentation for very old MS-DOS software, purely for historical purposes. If you're looking for up-to-date documentation, particularly for programming, you should not rely on the information found here, as it will be woefully out of date.
WinQuerySwitchList (1.2)
Overview                                            Up Next Previous
────────────────────────────────────────────────────────────────────────────
 
#define INCL_WINSWITCHLIST
 
USHORT WinQuerySwitchList(hab, pswblk, cbswblk)
HAB hab;            /* anchor-block handle            */
PSWBLOCK pswblk;    /* pointer to structure for items */
USHORT cbswblk;     /* structure length               */
 
The WinQuerySwitchList function obtains information about the items in the
Task List (the list of programs running in the system).
 
Parameter  Description
────────────────────────────────────────────────────────────────────────────
 
hab        Identifies the anchor block.
 
pswblk     Points to SWBLOCK structure that receives a description of all
           the items in the Task List.
 
cbswblk    Specifies the size (in bytes) of the SWBLOCK structure. This
           parameter may be zero to retrieve only the number of Task-list
           items.
 
Return Value
 
The return value is the current number of items in the Task List if the
function is successful or zero if an error occurs.
 
Comments
 
The SWBLOCK structure contains an array of SWENTRY structures. The first
array contains information about the Task List window. The second array
contains information about the first program in the Task List.
 
Example
 
This example calls WinQuerySwitchList to determine the number of items in
the Task List, allocates memory for the required buffer, and calls
WinQuerySwitchList again to fill the buffer with the information about each
program in the Task List.
 
USHORT cbItems, cbBuf;
PSWBLOCK pswblk;
SEL sel;
 
cbItems = WinQuerySwitchList(hab, (PSWBLOCK) NULL, 0);
cbBuf = (cbItems * sizeof(SWENTRY)) + sizeof(HSWITCH);
DosAllocSeg(cbBuf, &sel, SEG_NONSHARED);      /* allocates buffer   */
pswblk = MAKEP(sel, 0);
WinQuerySwitchList(hab, pswblk, cbBuf);       /* gets struct. array */
 
See Also
 
WinQuerySwitchEntry, SWBLOCK