Jump to content

WinFlashWindow: Difference between revisions

From EDM2
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..."
 
Ak120 (talk | contribs)
mNo edit summary
 
Line 1: Line 1:
This function starts or stops a window flashing.
This function starts or stops a window flashing.
==Syntax==
==Syntax==
  WinFlashWindow(hwndFrame, fFlash);
  WinFlashWindow(hwndFrame, fFlash)
 
==Parameters==
==Parameters==
;hwndFrame (HWND) - input
;hwndFrame (HWND) - input:Handle of window to be flashed.
:Handle of window to be flashed.  
;fFlash (BOOL) - input:Start-flashing indicator.
::TRUE - Start window flashing
::FALSE - Stop window flashing.


;fFlash (BOOL) - input
==Returns==
:Start-flashing indicator.
;rc (BOOL) - returns:Success indicator.
:;TRUE
::TRUE - Successful completion
::Start window flashing
::FALSE - Error occurred.
:;FALSE
::Stop window flashing.  


==Returns==
;rc (BOOL) - returns
:Success indicator.
:;TRUE
::Successful completion
:;FALSE
::Error occurred.
==Errors==
==Errors==
Possible returns from WinGetLastError
Possible returns from WinGetLastError
;PMERR_INVALID_HWND (0x1001)
;PMERR_INVALID_HWND (0x1001):An invalid window handle was specified.
:An invalid window handle was specified.
 
==Remarks==
==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 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.
Line 31: Line 25:


;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.
;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==
==Example Code==
This example uses WinFlashWindow to flash an inactive window to draw the user's attention to an important message in the window.
This example uses WinFlashWindow to flash an inactive window to draw the user's attention to an important message in the window.
Line 51: Line 46:
     0,                        /* message box id        */
     0,                        /* message box id        */
     MB_NOICON | MB_OK);        /* icon and button flags  */
     MB_NOICON | MB_OK);        /* icon and button flags  */
</pre>
Definition
<pre>
#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);
</pre>
</pre>



Latest revision as of 20:10, 12 April 2024

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  */

Related Functions