Table of Contents

This is part of Family API which allow to create dual-os version of program runs under OS/2 and DOS

Note: This is legacy API call. It is recommended to use 32-bit equivalent

2021/09/17 04:47 · prokushev · 0 Comments
2021/08/20 03:18 · prokushev · 0 Comments

DosBeep

This call generates sound from the speaker.

Syntax

  DosBeep (Frequency, Duration)

Parameters

Return Code

rc (USHORT) - return Return code descriptions are:

Notes

DosBeep executes synchronously. An application program that invokes DosBeep waits until the specified number of milliseconds expire before it resumes execution.

Example Code

C Binding

#define INCL_DOSPROCESS
 
USHORT  rc = DosBeep(Frequency, Duration);
 
USHORT  Frequency;     /* Hertz (Hz) */
USHORT  Duration;      /* Length of sound */
 
USHORT  rc;            /* return code */

MASM Binding

EXTRN  DosBeep:FAR
INCL_DOSPROCESS     EQU 1
 
PUSH   WORD    Frequency     ;Frequency (in Hertz)
PUSH   WORD    Duration      ;Length of sound (in milliseconds)
CALL   DosBeep

Returns WORD

Example

This example generates a beep for 1 second (1,000 milliseconds) at a frequency of 1,380.

#define INCL_DOSPROCESS
#define BEEP_FREQUENCY 1380
#define BEEP_DURATION 1000
 
USHORT  rc;
 
rc = DosBeep(BEEP_FREQUENCY,
             BEEP_DURATION);

Note

Text based on http://www.edm2.com/index.php/OS2_API:CPI:LEGACY:DosBeep