//dll 文件
library playSound; uses
SysUtils,
Classes;
{$R *.res}
//{$R 'XXX.RES' 'XXX.RC'} 自动编辑
{$R 'WavRes.RES' 'WavRes.rc'}
begin
end.
//调用dll中的WAV资源
uses MMSystem;{MMSystem}
procedure TForm1.Button1Click(Sender: TObject);
var
h: THandle;
rs:TResourceStream;
begin
h:=LoadLibrary('playSound.dll');
if h=0 then Exit; {mywav WAVE warning.wav}
rs:=TResourceStream.Create(h,'mywav','WAVE');
sndPlaySound(rs.Memory,SND_ASYNC or SND_MEMORY);
rs.Free;
FreeLibrary(h);
end;
{引用 http://www.77di.com/f2/17179.html
作者:未知
}
//把WAV资源封装到dll中