This example changes the program name of a task-list entry to "Generic: NEW.APP" using the handle returned by WinAddSwitchEntry.
#define INCL_WINSWITCHLIST /* Window Switch List Functions */ #define INCL_WINWINDOWMGR /* Window Manager Functions */ #include <os2.h> HSWITCH hswitch; /* task-list entry handle */ SWCNTRL swctl; /* switch-control data */ PID pid; /* process id */ HAB hab; /* anchor-block handle */ HWND hwndFrame; /* frame handle */ hab = WinQueryAnchorBlock(hwndFrame); /* gets anchor block */ WinQueryWindowProcess(hwndFrame, &pid, NULL);/* gets process id */ /* initialize switch structure */ swctl.hwnd = hwndFrame; /* window handle */ swctl.hwndIcon = NULLHANDLE; /* icon handle */ swctl.hprog = NULLHANDLE; /* 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 = WinCreateSwitchEntry(hab, &swctl); /* set application name */ strcpy(swctl.szSwtitle, "Generic: NEW.APP"); WinChangeSwitchEntry(hswitch, &swctl);