Set Bell, Set("Bell")
SET BELL can be toggled to determine if you want to annoy your end users endlessly and drive them to an early grave by beeping at them when they reach the end of a field. To further annoy them, you can change the bell's exact sound (or the sound file it plays) as well. The chosen sound is also played when the CHR(7) character is displayed to the screen.
Usage |
SET BELL ON | OFF SET BELL TO [ nFreq, nSeconds ] && MS-DOS version SET BELL TO [ cWavFile, nNothing ] && Windows, VFP 3 & 5 version SET BELL TO [ cWavFile ] && VFP 6 and later, at last! cBellOnOff = SET( "BELL" ) cWavFile = SET( "BELL" , 1 ) |
Parameter |
Value |
Meaning |
nFreq |
Numeric |
Approximate frequency of the bell sounds, in Hertz, range 19 to 10,000—MS-DOS ONLY!!! |
nSeconds |
Numeric |
Length of time the annoying tone plays, in seconds—MS-DOS ONLY!!! |
cWavFile |
Character |
Name of a sound file, with path if necessary or, in FoxPro/Windows, the name of a pre-defined sound in the [Sound] section of WIN.INI. |
nNothing |
Numeric |
This parameter is ignored, but an error, "Missing expression", occurs if not passed. Useless. |
Omitted |
Restores the bell to its "normal" condition—a bell sound in DOS and the system setting for the bell under Windows. |
Prior to VFP 6, there was no way to determine what settings were in place, beyond SET("BELL") returning "ON" or "OFF." VFP 6 introduced SET("BELL",1) to return the name of the WAV file, if one is set. |
Example |
SET BELL TO "C:\WINNT\MEDIA\TADA.WAV" ?? CHR(07) && The WAV file is played. ? SET("BELL", 1) && Returns "C:\WINNT\MEDIA\TADA.WAV" * This is how easy it should be. This works in FPW: SET BELL TO "SystemExclamation",5 ?? CHR(07) && user-defined sound is played. * This is how easy it is?: oRegistry = NEWOBJECT("Registry", HOME() + "FFC\REGISTRY.VCX") HKEY_CURRENT_USER = -2147483647 && BITSET(0,31)+1 cValue = SPACE(255) oRegistry.GetRegKey("",@cValue,; "AppEvents\Schemes\Apps\.Default\SystemExclamation\.Current",; HKEY_CURRENT_USER) IF "\" $ cValue * This is an explicit path * The Windows\media path is assumed if not supplied ELSE cValue = "C:\WINNT\Media\" + cValue ENDIF IF FILE(cValue) SET BELL TO cValue ENDIF ?? CHR(07) |
See Also |