做在DLL里,我没有试过。
我可以给你看一个在线程播放WAV的例子,这是我在一个安防报警的项目里用到的。这个线程调用资源文件中的UW的WAV资源。
把 HYGSXY的顺序换一下试试,
1:你把wav,mini做到res文件里
2:把资源文件放到DLL中
3:做一个接口:该接口创建一个我下面那个线程。
4:编译DLL
5:在你的EXE里加载库
6:调用接口
unit PlaythreadUnit;
interface
uses
Classes,MMSystem, SysUtils;
type
TPlaythread = class(TThread)
private
{ Private declarations }
protected
procedure Execute;
override;
public
Constructor Create(b:boolean);
Destructor Destroy;override;
end;
implementation
{ Important: Methods and properties of objects in VCL or CLX can only be used
in a method called using Synchronize, for example,
Synchronize(UpdateCaption);
and UpdateCaption could look like,
procedure TPlaythread.UpdateCaption;
begin
Form1.Caption := 'Updated in a thread';
end;
}
{ TPlaythread }
constructor TPlaythread.Create(b: boolean);
begin
inherited Create(True);
self.FreeOnTerminate:=True;
self.Suspended:=False;
end;
destructor TPlaythread.Destroy;
begin
inherited;
end;
procedure TPlaythread.Execute;
var
i:integer;
begin
for i:=1 to 40do
begin
PlaySound('UW',hInstance,SND_RESOURCE);
sleep (3000);
end;
{ Place thread code here }
end;
end.