This example calls WinQueryTaskTitle to retrieve the application's title, and then sets the title bar of the frame window to that title. (The WinQuerySessionTitle could be used instead).

#define INCL_WINSWITCHLIST
#include <OS2.H>

HAB     hab;
HWND    hwndFrame, hwndClient;
CHAR    szTitle[MAXNAMEL + 1];
HSWITCH hswitch;
SWCNTRL swctl;

hswitch = WinQuerySwitchHandle(hwndFrame, 0);
WinQuerySwitchEntry(hswitch, &swctl);

WinQueryTaskTitle(0,
                  szTitle,
                  sizeof(szTitle));

hwndFrame = WinQueryWindow(hwndClient,
                           QW_PARENT); /* get handle of parent,  */
                                          /* which is frame window. */
WinSetWindowText(hwndFrame, szTitle);


[Back] [Next]