This example shows how to query a window's process and use that information to add a switch entry window.
#define INCL_WINWINDOWMGR #define INCL_WINSYS #include <OS2.H> HWND hwndFrame; /* window handle. */ SWCNTRL swctl; PID pid; TID tid; HSWITCH hsw; char szTitle[] = "app.exe"; WinQueryWindowProcess( hwndFrame, &pid, &tid); swctl.hwnd = hwndFrame; swctl.idProcess = pid; strcpy( swctl.szSwtitle, szTitle); hsw = WinAddSwitchEntry( &swctl);