unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls, MMSystem;

type
  TForm1 = class(TForm)
    Button1: TButton;
    StaticText1: TStaticText;
    procedure FormCreate(Sender: TObject);
    procedure Button1Click(Sender: TObject);
    procedure FormClose(Sender: TObject; var Action: TCloseAction);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;
  DllH: THandle;
implementation

{$R *.dfm}

procedure TForm1.FormCreate(Sender: TObject);
begin
dllh:=LoadLibrary('MyResourse.dll');

end;

procedure TForm1.Button1Click(Sender: TObject);
begin
PlaySound('WAV_1',dllh,SND_RESOURCE);
end;

procedure TForm1.FormClose(Sender: TObject; var Action: TCloseAction);
begin
freeLibrary(dllh);
end;


end.
 