This function obtains the title under which a specified application is started, or is added to the Window List. (See also WinQuerySessionTitle, which you should use for preference.)
#define INCL_WINSWITCHLIST /* Or use INCL_WIN, INCL_PM, */ #include <os2.h> ULONG ulSession; /* Session identity of application whose title is requested. */ PSZ pszTitle; /* Window List title. */ ULONG ulTitlelen; /* Maximum length of data returnable, in bytes. */ ULONG rc; /* Return code. */ rc = WinQueryTaskTitle(ulSession, pszTitle, ulTitlelen);