Delphi defines the beep method in the sysutils unit and can make a sound, which is generally used for reminder and debugging.
Beep is actually the called API function: messagebeep (mb_ OK );
Messagebeep can be used to call different audio files in the following ways:
Messagebeep (mb_ OK); messagebeep (mb_iconhand); messagebeep (messages); {This does not sound, do not know why} messagebeep (messages); messagebeep ($ ffffff ); {same as messagebeep (mb_ OK );}
Beep is also an API function that specifies the sound height and length. Because it has the same name as sysutils. Beep, you should call it like this:
Windows. Beep (pitch, length );
For example, windows. Beep (440,200 0) will play an international standard sound (440Hz) for 2 seconds.
The value range of the first parameter is $25-$ 7ffff.
The followingProgramThe first sentence:
unit unit1; interfaceuses windows, messages, sysutils, variants, classes, graphics, controls, forms, dialogs, stdctrls; Type tform1 = Class (tform) button1: tbutton; Procedure button1click (Sender: tobject); end; var form1: tform1; implementation {$ R *. DFM} procedure tform1.button1click (Sender: tobject); const T = 800; begin windows. beep (330, T); windows. beep (392, T); windows. beep (262, T * 2); windows. beep (294, T); windows. beep (330, T); windows. beep (196, T * 2); windows. beep (262, T); windows. beep (294, T); windows. beep (330, T); windows. beep (392, T); windows. beep (294, T * 4); end.