This example calls WinTerminate in a typical termination sequence.
#define INCL_WINWINDOWMGR #include <OS2.H> HAB hab; HWND hwndFrame; QMSG qmsg; HMQ hmq; while( WinGetMsg( hab, &qmsg, NULL, 0, 0 ) ) WinDispatchMsg( hab, /* PM anchor block handle */ &qmsg ); /* pointer to message */ /* Destroy the standard windows if they were created. */ if ( hwndFrame != NULL ) WinDestroyWindow( hwndFrame ); /* frame window handle */ /* Destroy the message queue and release the anchor block. */ if ( hmq != NULL ) WinDestroyMsgQueue( hmq ); if ( hab != NULL ) WinTerminate( hab );