WinTerminate
Appearance
WinTerminate clean up after resouce allocated by WinInitialize function.
Syntax
WinTerminate( hab )
Parameters
- hab (HAB) - input
- Handle of Anchor Block returned from WinInititalize.
Returns
- rc (BOOL) - returns
- Termination indicator.
- TRUE
- Application usage of Presentation Manager successfully terminated
- FALSE
- Application usage of Presentation Manager not successfully terminated, or WinInitialize has not been issued on this thread.
Remarks
It is good practice to issue this function before terminating an application thread. Before issuing this function, the application must destroy all windows and message queues that have been created by the thread, and return any cached presentation spaces to the cache. If it does not do so, the results, and the return value from this and subsequent calls are indeterminate.
Include Info
#define INCL_WIN
or
#include INCL_PM
or
#define INCL_WINDOWMGR #include <os2.h>
Sample Code
Definition:
#define INCL_WINWINDOWMGR /* Or use INCL_WIN, INCL_PM, Also in COMMON section */ #include <os2.h> HAB hab; /* Anchor-block handle. */ BOOL rc; /* Termination indicator. */ rc = WinTerminate(hab);
Sample:
int main() { HAB hab; hab = WinInitialize( 0 ); ... WinTerminate( hab ); return 0; }
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 );