Type a page name and press Enter. You'll jump to the page if it exists, or you can create it if it doesn't.
To create a page in a module other than kernel32, prefix the name with the module name and a period.
static void Main()
{
Console.WriteLine("Testing PC speaker...");
for (uint i = 100; i <= 20000; i++)
{
Beep(i, 5);
}
Console.WriteLine("Testing complete.");
}
}
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.
// This sends sound to the 'speaker' which may not exist in more recent
// version of windows (or at least the hardware that the Beep() function is
// 'wired' may not exist. But if you get a delay when running this, it
// probably worked even if no sound.
// Save to beep.c, and compile at the command line with:
// gcc -Wall beep.c /cygdrive/c/windows/system32/kernel32.dll
// Note: the /cygdrive/.../kernel32.dll might be unneeded, bit it shows
// how things work
printf("Testing PC speaker...\n");
for (i = 300; i <= 20000; i += 25)
if (0 == Beep(i, 5)) errx(1, "Beep() fails & returns 0");
printf("Testing complete.\n");
return 0;
}
Added by John Refling
Alternative Managed API:
System.Console.Beep
Adendum 2007 AUG 14
This function does nothing when imported into a VB6 application. It does however work properly when called directly from a C++ application compiled with MSVC6.
helpful tips or sample code to share for using this API in managed code?
corrections to the existing content?
variations of the signature you want to share?
additional languages you want to include?
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).