Scalabium Software

SMReport Autogenerated
Knowledge for your independence'.
Home Delphi and C++Builder tips


#78: How can I sound a beep for some action?

Sometimes in development very useful to sound a "context" beep. For example, user entered the incorrect value - you can show the message dialog with information about it but also useful to beep with "error" sound.

Try this - it's very useful for end-user as context help/assistent:

uses Windows;

procedure PlayBeep(ActionType: TMsgDlgType);
var mb: dWord;
begin
  case ActionType of
    mtInformation: mb := MB_ICONASTERISK; //SystemAsterisk
    mtWarning: mb := MB_ICONEXCLAMATION; //SystemExclamation
    mtError: mb := MB_ICONHAND; //SystemHand
    mtConfirmation: mb := MB_ICONQUESTION; //SystemQuestion
    mtCustom: mb := MB_OK; //SystemDefault
  else
    mb:= $0FFFFFFFF; //Standard beep using the computer speaker
  end;
  MessageBeep(mb);
end;

PS: don't use it very frequently because users'll be angry:)


Published: May 18, 2000

See also
 
Clarion to Text converter/a>
ABA Database Convert
Metafile Convert
ABA Picture Convert
Clarion Viewer
Excel Web-stream
DBISAM Password Recovery
Database Information Manager
ExcelFile Viewer
Word Web-stream
 
 


Contact to webmaster

 

Borland Software Code Gear Scalabium Delphi tips

Copyright© 1998-2017, Scalabium Software. All rights reserved.
webmaster@scalabium.com

SMReport Autogenerated