Jump to content

WinSetSysModalWindow

From EDM2
Revision as of 18:12, 9 April 2025 by Martini (talk | contribs) (Remarks)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

This function makes a window become the system-modal window, or ends the system-modal state.

Syntax

WinSetSysModalWindow(hwndDesktop, hwnd)

Parameters

hwndDesktop (HWND) - Input
Desktop-window handle, or HWND_DESKTOP.
hwnd (HWND) - Input
Handle of window to become system-modal window.
If NULLHANDLE, system-modal state is ended, and input processing returns to its normal state.

Returns

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

Remarks

Input processing can enter a "system modal" state. In this state, all pointing device and keyboard input is directed to a special window, known as the system-modal window, or to one of its child windows (or a window owned by one of them). An "owned" window is a window that refers to its owner window set by using either the hwndOwner parameter of the WinCreateWindow function or the hwndNewOwner parameter of the WinSetOwner function. All other main windows behave as though they are disabled and no interaction is possible with them.

Note
The disabled windows are not actually disabled, but made noninteractive. No messages are sent to these windows when the system-modal state is entered or left, and their WS_DISABLE style bits are not changed.

Where a system-modal window exists and another window is explicitly made the active window, the newly activated window becomes the system-modal window. This replaces the old one, which becomes a noninteractive window. When the system-modal window is destroyed, the system-modal state is ended, and input processing returns to its normal state.

This function should only be called while processing pointing device or keyboard input.

The new system-modal window is not locked during the processing of this function.

Errors

Possible returns from WinGetLastError:

  • PMERR_INVALID_HWND (0x1001) An invalid window handle was specified.

Example Code

#define INCL_WINWINDOWMGR /* Or use INCL_WIN, INCL_PM, */
#include <os2.h>

HWND    hwndDesktop;  /*  Desktop-window handle, or HWND_DESKTOP. */
HWND    hwnd;         /*  Handle of window to become system-modal window. */
BOOL    rc;           /*  Success indicator. */

rc = WinSetSysModalWindow(hwndDesktop, hwnd);

This example uses the WinSetModalWindow to set a system modal window.

#define INCL_WINWINDOWMGR
#include <OS2.H>
HWND hwndSysModal;

/*  Input processing can enter a "system modal" state. In */
/*  this state, all pointing  device and keyboard input   */
/*  is directed to a special window, known as the         */
/*  system-modal window. Typically, this will be a dialog */
/*  window requiring input.                               */

WinSetSysModalWindow(HWND_DESKTOP,hwndSysModal);

Related Functions