Jump to content

WinCancelShutdown

From EDM2
Revision as of 01:01, 17 April 2022 by Martini (talk | contribs) (Created page with "This function cancels a request for an application to shut down. ==Syntax== WinCancelShutdown(hmq, fCancelAlways); ==Parameters== ;hmq (HMQ) - input :Handle of message que...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

This function cancels a request for an application to shut down.

Syntax

WinCancelShutdown(hmq, fCancelAlways);

Parameters

hmq (HMQ) - input
Handle of message queue for current thread.
fCancelAlways (BOOL) - input
Cancellation control.
TRUE
No WM_QUIT message should be placed on this queue during system shutdown.
FALSE
The applications ignore any outstanding WM_QUIT messages already sent to it, but a message should be sent during other system shutdowns.

Returns

rc (BOOL) - returns
Success indicator.
TRUE
Successful completion
FALSE
Error occurred.

Remarks

On a system shutdown, each message queue normally posts a WM_QUIT message. An application can then handle this message in one of the three ways:

  • Destroy its message queue using WinDestroyMsgQueue (hmq).
  • Call WinCancelShutdown (hmq, TRUE) to prevent the current thread's event queue from receiving the WM_QUIT messages when the system is shut down. This does not stop other threads from receiving this message.
  • Call WinCancelShutdown (hmq, FALSE) to remove all pending WM_QUIT messages from the current thread's event queue but allow future WM_QUIT messages to be posted.

Either way, the system can proceed to the next queue.

Example Code

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

HMQ hmq; /* Handle of message queue for current thread. */ BOOL fCancelAlways; /* Cancellation control. */ BOOL rc; /* Success indicator. */

rc = WinCancelShutdown(hmq, fCancelAlways);

This example cancels a shutdown request (WM_QUIT message) and specifies that the message queue will not accept any new WM_QUIT messages.

  1. define INCL_WINMESSAGEMGR /* Window Message Functions */
  2. include <os2.h>

HAB hab, BOOL fSuccess; /* Success indicator */ HMQ hmq; /* Queue handle */

hmq = WinCreateMsgQueue(hab, 0); fSuccess = WinCancelShutdown(hmq, TRUE);

Related Functions

Related Messages