Consultor Eletrônico



Kbase 17939: How to Call WIN32 API Function: Beep
Autor   Progress Software Corporation - Progress
Acesso   Público
Publicação   5/18/1998
How to Call WIN32 API Function: Beep

DISCLAIMER:
===========
The code example in this knowledgebase is for informational purposes
only. If you have specific questions about which API calls would be
best suited to your design goals, please consult your Microsoft
documentation.

INTRODUCTION:
=============
The following sample code shows how to call the Win32 API function
called Beep. This function produces tones on the speaker of a
specified frequency and duration. Under Windows 95, Beep() will only
produce the default system beep.

This code has been tested on Windows NT 4.0 Workstation only.


DEFINE VARIABLE intRC AS INTEGER NO-UNDO.

PROCEDURE Beep EXTERNAL "KERNEL32.DLL":
DEFINE INPUT PARAMETER intFrequency AS LONG.
DEFINE INPUT PARAMETER intDuration AS LONG.
DEFINE RETURN PARAMETER intRC AS LONG.
END PROCEDURE.

RUN Beep (300, 2000, OUTPUT intRC).

IF intRC <> 0 THEN
MESSAGE "Beep Call Worked" VIEW-AS ALERT-BOX.
ELSE
MESSAGE "Beep Call Failed" VIEW-AS ALERT-BOX.