This question already has an answer here:
Playing sound in firemonkey
3 answers
In VCL, for Windows, I used the code:
uses
…, MMSystem;
sound_holy:Pointer;
…
procedure TWM.SpeedButton3Click(Sender: TObject);
begin
sndPlaySound(sound_holy, SND_MEMORY or SND_NODEFAULT or SND_ASYNC);
end;
…
initialization
sound_holy := Pointer(FindResource(hInstance, ‘holy’, ‘RCDATA’));
if sound_holy <> nil then
begin
sound_holy := Pointer(LoadResource(hInstance, HRSRC(sound_holy)));
if sound_holy <> nil then
sound_holy := LockResource(HGLOBAL(sound_holy));
end;
end.
program should play a “holy.wav” file from a resource “RCDATA” with the name “holy”.
Amended: the question is not a duplicate. I need to store sounds my_project_name.res resource file.
Solution: I moved the sounds in the file resources of RCDATA directory t directory WAVE, and edit code:
… initialization
sound_holy := Pointer(FindResource(hInstance, ‘holy’, ‘WAVE’));