unit DdhSounB; interface uses Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, StdCtrls; {$R *.DCR} type TDdhSoundButton = class(TButton) private FSoundUp, FSoundDown: string; protected procedure MouseDown(Button: TMouseButton; Shift: TShiftState; X, Y: Integer); override; procedure MouseUp(Button: TMouseButton; Shift: TShiftState; X, Y: Integer); override; published property SoundUp: string read FSoundUp write FSoundUp; property SoundDown: string read FSoundDown write FSoundDown; end; procedure Register; implementation uses MMSystem; procedure TDdhSoundButton.MouseDown(Button: TMouseButton; Shift: TShiftState; X, Y: Integer); begin inherited MouseDown (Button, Shift, X, Y); PlaySound (PChar (FSoundDown), 0, snd_Async); end; procedure TDdhSoundButton.MouseUp(Button: TMouseButton; Shift: TShiftState; X, Y: Integer); begin inherited MouseUp (Button, Shift, X, Y); PlaySound (PChar (FSoundUp), 0, snd_Async); end; procedure Register; begin RegisterComponents('DDHB', [TDdhSoundButton]); end; end.