Hi, :P
ok how do u add a .wav file inside a .exe so it is not a seperate file that can be tampered with...;)
then how do i play the file on request...? :D
thanx in advance
aSk_U
Printable View
Hi, :P
ok how do u add a .wav file inside a .exe so it is not a seperate file that can be tampered with...;)
then how do i play the file on request...? :D
thanx in advance
aSk_U
Create a Resource File and add the WAV(s) to it with meaning full ID's, then use a modified version of the sndPlaySound() API to play them from memory, after loading the Resource WAV into a Binary Array, i.e.
Regards,Code:Private Declare Function sndPlaySound Lib "winmm.dll" Alias "sndPlaySoundA" (lpszSoundName As Any, ByVal uFlags As Long) As Long
Private Const SND_MEMORY = &H4 ' lpszSoundName points to a memory file
Private Const SND_ASYNC = &H1 ' play asynchronously
Private Sub Command1_Click()
Dim vSnd() As Byte
vSnd = LoadResData("SOUND1", "CUSTOM")
Call sndPlaySound(vSnd(0), SND_MEMORY Or SND_ASYNC)
End Sub
- Aaron.
playing the file, requires API
I didnt exactly know what to put for the last option, so I just put an empty variableCode:PlaySound "c:\my documents\Genflit0.wav", 0, d
DoEvents
this will work, but first put this in a module
Code:Public Declare Function PlaySound Lib "winmm.dll" Alias "PlaySoundA" (ByVal lpszName As String, ByVal hModule As Long, ByVal dwFlags As Long) As Long
Public Type WAVEFORMAT
wFormatTag As Integer
nChannels As Integer
nSamplesPerSec As Long
nAvgBytesPerSec As Long
nBlockAlign As Integer
End Type