开发者

C++ Put wav file into dll

开发者 https://www.devze.com 2023-02-14 21:29 出处:网络
I wa开发者_如何学Gont to include one wav file into dll and play it later. How to do it? I know how to play file that is in the same direcory. But I want to include around 50 wav files into my dll.You

I wa开发者_如何学Gont to include one wav file into dll and play it later. How to do it? I know how to play file that is in the same direcory. But I want to include around 50 wav files into my dll.


You embed such files as resources.

You need a resource file, and e.g.

MY_WAV WAVE "file.wav"

Then to play it directly, use PlaySound.

PlaySound("MY_WAV", hInstance, SND_RESOURCE);

hInstance should be the handle passed to your DllMain


i would recommend using Bass http://www.un4seen.com/ and mp3 instead of wav

if you want to include it in your dll (load the bass.dll from memory) i can tell you how to do that (just not here)

to include wav/mp3 files in your PE (be it exe/dll) use resources

0

精彩评论

暂无评论...
验证码 换一张
取 消