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.
WinAddSwitchEntry (1.2)
Overview                                            Up Next Previous
────────────────────────────────────────────────────────────────────────────
 
#define INCL_WINSWITCHLIST
 
HSWITCH WinAddSwitchEntry(pswctl)
PSWCNTRL pswctl;    /* address of structure with new entry information */
 
The WinAddSwitchEntry function adds an entry to the switch list (the list of
running programs that is displayed by the Task Manager).
 
Parameter  Description
────────────────────────────────────────────────────────────────────────────
 
pswctl     Points to the SWCNTRL structure that contains information about
           the new switch-list entry. If the szSwtitle field in the SWCNTRL
           structure is NULL, the system uses the name under which the
           application was started. This applies only for the first call to
           this function for that program (since the program was started).
           Otherwise, a NULL entry name is invalid.
 
Return Value
 
The return value is a handle to the new switch-list entry, or NULL if an
error occurs.
 
Comments
 
Leading and trailing blanks are removed from the title. The title is
truncated to 60 characters.
 
Example
 
This example calls WinQueryWindowProcess to get the current process
identifier (needed for the SWCNTRL structure). It then sets up the swctl
structure and calls WinAddSwitchEntry to add the program's name to the task
list. The returned handle can be used in subsequent calls to
WinChangeSwitchEntry if the title needs to be changed. The variables swctl,
hswitch, and pid should be global if your application will be calling the
WinChangeSwitchEntry function to avoid having to set up the structure
again.
 
SWCNTRL swctl;
HSWITCH hswitch;
PID pid;
 
WinQueryWindowProcess(hwndFrame, &pid, (PTID) NULL);
 
swctl.hwnd = hwndFrame;                 /* window handle      */
swctl.hwndIcon = (HWND) NULL;           /* icon handle        */
swctl.hprog = (HPROGRAM) NULL;          /* program handle     */
swctl.idProcess = pid;                  /* process identifier */
swctl.idSession = 0;                    /* session identifier */
swctl.uchVisibility = SWL_VISIBLE;      /* visibility         */
swctl.fbJump = SWL_JUMPABLE;            /* jump indicator     */
swctl.szSwtitle[0] = '\0';              /* program name       */
 
hswitch = WinAddSwitchEntry(&swctl);
 
See Also
 
WinChangeSwitchEntry, WinQueryWindowProcess, WinRemoveSwitchEntry, SWCNTRL