win12.hlp (Table of Contents; Topic list)
Important Notice
The pages on this site contain documentation for very old MS-DOS software, purely for historical purposes. If you're looking for up-to-date documentation, particularly for programming, you should not rely on the information found here, as it will be woefully out of date.
WinAlarm (1.2)
Function Group  Overview                          Up Next Previous
────────────────────────────────────────────────────────────────────────────
 
#define INCL_WINDIALOGS
 
BOOL WinAlarm(hwndDesktop, fsType)
HWND hwndDesktop;    /* handle of the desktop */
USHORT fsType;       /* alarm style           */
 
The WinAlarm function generates an audible alarm that can be used to alert
the user about special conditions.
 
Parameter    Description
────────────────────────────────────────────────────────────────────────────
 
hwndDesktop  Identifies the desktop window. This parameter can be
             HWND_DESKTOP or the desktop window handle.
 
fsType       Specifies the alarm style. It can be one of the following
             values:
 
                  WA_WARNING
                  WA_NOTE
                  WA_ERROR
 
Return Value
 
The return value is TRUE if the function is successful or FALSE if an error
occurs.
 
Comments
 
The duration and frequency of the alarm can be changed by the
WinSetSysValue function. The alarm is not generated if the system value
SV_ALARM is set to FALSE.
 
The following system values control the alarm:
 
Value               Meaning
────────────────────────────────────────────────────────────────────────────
SV_ALARM            Specifies whether calls to WinAlarm generate a sound. A
                    value of TRUE means sound is generated.
 
SV_ERRORDURATION    Specifies the duration in milliseconds of a WA_ERROR
                    sound.
 
SV_ERRORFREQ        Specifies the frequency in cycles per second of a
                    WA_ERROR sound.
 
SV_NOTEDURATION     Specifies the duration in milliseconds of a WA_NOTE
                    sound.
 
SV_NOTEFREQ         Specifies the frequency in cycles per second of a
                    WA_NOTE sound.
 
SV_WARNINGDURATION  Specifies the duration in milliseconds of a WA_WARNING
                    sound.
 
SV_WARNINGFREQ      Specifies the frequency in cycles per second of a
                    WA_WARNING sound.
 
Example
 
This example calls an application-defined initialization function, and if
the function fails it calls WinAlarm to generate an audible alarm notifying
the user the initialization failed.
 
if (!GenericInit()) {                      /* general initialization */
    WinAlarm(HWND_DESKTOP, WA_ERROR);
 
See Also
 
WinFlashWindow, WinSetSysValue