-
I want my application to have a wave file in it i know that it is can be by a resource file but using images and icons files . like that i need my project to have itself and its wave files in one files and i could to play then also even by converting then to alone-standing files before playing them
-
Take a look at this example from www.planet-source-code.com. The author says that you can embed wav files in your exe.
-
I don't know if I understand you correctly. Do you want to include a wave file in your Exe an then have your Exe file write the wave file back to the disk?
If this is want you want then open up the resource editor and click on the "Add Custom Resource..." button on the toolbar.
Select your wave file and click OK.
Now in the treeview you will see a node called "Custom" and as a child node of that you will have your resource with a special ID.
This code sample assumes the ID is 101.
Code:
Public Sub SaveWavFile(sFilename As String)
Dim bArr() As Byte
Dim iFile As Integer
iFile = FreeFile
Open sFilename For Binary Access Read As #iFile
bArr = LoadResData(101, "CUSTOM")
Put #iFile, , bArr
Close #iFile
End Sub
Now you can call SaveWavFile like this:
Code:
SaveWavFile "c:\MyWave.wav"
Good luck!
-
done well but the sound quality is very poor
-
-
Unfortunate my sample code is MIA, but it is possible to store a wav file in your exe's resource file, load the wav file into a string buffer in memory at runtime, then use the WinMM (IIRC) API to play the wav from the string buffer directly from memory.
-
i done , but the quality is bad