Desktop Functions: Smart Device Functions:
|
Beep (kernel32)
C# Signature:
[DllImport("kernel32.dll", SetLastError=true)] VB.NET Signature:
<DllImport("kernel32.dll", SetLastError := True)> _ VB 6 Signature:
Declare Function Lib "kernel32.dll" Alias "Beep" (ByVal dwFrequency As Long, ByVal dwMilliseconds As Long) As Long Parameter Information:dwFreq Windows NT: Specifies the frequency, in hertz, of the sound. This parameter must be in the range 37 through 32767 (0x25 through 0x7FFF). Windows 95: The parameter is ignored. dwDuration Windows NT: Specifies the duration, in milliseconds, of the sound. Windows 95: The parameter is ignored. Return ValuesIf the function succeeds, the return value is nonzero. If the function fails, the return value is zero. To get extended error information, call GetLastError. Notes:Unlike MessageBeep, this function is synchronous. (It doesn’t return control to its caller until the sound finishes.) Tips & Tricks:Please add some sample code! Sample Code:The following sample plays the PC speaker in a series of ascending frequencies:
using System; Added by David Carachi Sample code for gcc on Cygwin:Just to show how simple it is with cygwin. The hard part is figuring out the include files. But you can grep thru /usr/include// to find Beep, which is in utilapiset.h. The first 2 includes seem to be always needed.
#include <w32api/windef.h> Added by John Refling Alternative Managed API:System.Console.Beep Adendum 2007 AUG 14This function does nothing when imported into a VB6 application. It does however work properly when called directly from a C++ application compiled with MSVC6. Added by Barny Short -VB.NET 10 addition by: Shawn LaRoche Please edit this page!Do you have...
Select "Edit This Page" on the right hand toolbar and edit it! Or add new pages containing supporting types needed for this API (structures, delegates, and more). |
|