Jump to content

WinFlashWindow

From EDM2
Revision as of 15:17, 7 April 2024 by Martini (talk | contribs) (Created page with "This function starts or stops a window flashing. ==Syntax== WinFlashWindow(hwndFrame, fFlash); ==Parameters== ;hwndFrame (HWND) - input :Handle of window to be flashed. ;fF...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

This function starts or stops a window flashing.

Syntax

WinFlashWindow(hwndFrame, fFlash);

Parameters

hwndFrame (HWND) - input
Handle of window to be flashed.
fFlash (BOOL) - input
Start-flashing indicator.
TRUE
Start window flashing
FALSE
Stop window flashing.


Returns

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

Errors

Possible returns from WinGetLastError

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

Remarks

Flashing a window brings the user's attention to a window that is not the active window, where some important message or dialog must be seen by the user.

Flashing is typically done by inverting the title bar continuously. The alarm is sounded for the first five flashes.

Note
It should be used only for important messages, for example, where some component of the system is failing and requires immediate attention to avoid damage.

Example Code

This example uses WinFlashWindow to flash an inactive window to draw the user's attention to an important message in the window.

#define INCL_WINFRAMEMGR        /* Window Frame Functions       */
#define INCL_WINDIALOGS         /* Window Dialog Mgr Functions  */
#include <os2.h>

BOOL  fSuccess;         /* Success indicator                    */
HWND  hwnd;             /* window handle                        */

/* flash window to get user's attention */
fSuccess = WinFlashWindow(hwnd, TRUE);

/* vital message is displayed */
WinMessageBox(HWND_DESKTOP,
    hwnd,                      /* client-window handle   */
    "Important message: must be seen by user",/* message */
    "Vital message",           /* title of the message   */
    0,                         /* message box id         */
    MB_NOICON | MB_OK);        /* icon and button flags  */

Definition

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

HWND    hwndFrame;  /*  Handle of window to be flashed. */
BOOL    fFlash;     /*  Start-flashing indicator. */
BOOL    rc;         /*  Success indicator. */

rc = WinFlashWindow(hwndFrame, fFlash);

Related Functions