一个播放自定义过程
procedure MyPlaySound(WavFileName: String;
sndType: Byte);
var
WavFileNameStr: array [0..128] of Char;
PtrSound: PChar;
hRes: THandle;
hResInfo: THandle;
begin
StrPCopy(WavFileNameStr,WavFileName);
hResInfo:=FindResource(HInstance,WavFileNameStr,'WAVE');
hRes:=LoadResource(HInstance, hResInfo);
if hRes>32 then
PtrSound:=LockResource(hRes);
if sndType=0 then
sndPlaySound(PtrSound, snd_Async or snd_Memory);
if sndType=1 then
sndPlaySound(PtrSound, snd_Sync or snd_Memory);
if sndType=2 then
sndPlaySound(PtrSound, snd_Async or snd_Memory or snd_Loop);
if sndType=99 then
sndPlaySound(PtrSound, 0);
end;