Today, Delphi is one of the popular desktop programming tool. There are thousand even million programmer in this world using delphi as their favorit tool. This site try to collect the examples, tips and tricks of Delphi programming. We collect, test them and redistribute the collection of delphi programming for you.

Play a Wav Sound Without TMediaPlayer

Author: admin | Category: Multimedia, Tips and Tricks

//This is we can play a WAV file without TMediaPlayer Component
//Using PlaySound Function declared in mmsystem unit
//So you must add mmsystem in uses clause
 
unit Unit1;
 
interface
 
uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, ComCtrls, MPlayer, StdCtrls;
 
type
  TForm1 = class(TForm)
    Button1: TButton;
    procedure Button1Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;
 
var
  Form1: TForm1;
 
implementation
 
{$R *.dfm}
 
uses
  mmsystem;
 
procedure TForm1.Button1Click(Sender: TObject);
begin
   PlaySound(PChar('C:\WINDOWS\Media\Windows XP Startup.wav'),0,SND_ASYNC)
end;
 
end.
 

Tags: ,