Jump to content

WinDestroyMsgQueue

From EDM2

This function destroys the message queue.

Syntax

WinDestroyMsgQueue(hmq)

Parameters

hmq (HMQ) - input
Message-queue handle.

Returns

rc (BOOL) - returns
**Queue-destroyed indicator**.
TRUE
**Queue destroyed**
FALSE
**Queue not destroyed**

Errors

Possible returns from WinGetLastError:

PMERR_INVALID_HMQ (0x1002)
An **invalid message-queue handle** was specified.

Remarks

This function **must be called before terminating a thread or an application**. Only the thread that called WinCreateMsgQueue may call this function with that handle.

Example Code

#define INCL_WINMESSAGEMGR /* Or use INCL_WIN, INCL_PM, Also in COMMON section */
#include <os2.h>

HMQ     hmq;  /*  Message-queue handle. */
BOOL    rc;   /*  Queue-destroyed indicator. */

rc = WinDestroyMsgQueue(hmq);

This example destroys, using **`WinDestroyMsgQueue`**, a message queue previously created by WinCreateMsgQueue.

#define INCL_WINMESSAGEMGR /* Window Message Functions */
#define INCL_WINWINDOWMGR /* Window Manager Functions */
#include <os2.h>

BOOL fDestroyed; /* success of destroy call */
HAB hab; /* anchor-block handle */
HMQ hmq; /* message queue handle */

hab = WinInitialize(0); /* initialize PM */
hmq = WinCreateMsgQueue(hab, 0); /* create default size queue */
/*

... initialize windows, message loop ...

*/
fDestroyed = WinDestroyMsgQueue(hmq);


Related Functions