How to load custom resource?
- From: Darko Pogačić <darko.pogacic@xxxxxxxxx>
- To: <programmingblind@xxxxxxxxxxxxx>
- Date: Sat, 24 Jan 2009 23:37:34 +0100
Hello!
I am using vb 6, but I have problem to load a custom resource, by using
LoadResData VB function.
I've made a .res file with wave custom resource from a .wav file, and I have
added the resource file into my VB project.
When I do the following, my program result's no sound playing, or play's only
default sound.
For sound playing, I used windows API function sndPlaySound instead PlaySound,
because function sndPlaySound allows set flags parameter.
Firs, I was build a .bas module with the following code:
Public Declare Function sndPlaySound Lib "winmm.dll" Alias "sndPlaySoundA"
(ByVal lpszSoundName As String, ByVal uFlags As Long) As Long
Public Const SND_LOOP = &H8 ' loop the sound until next sndPlaySound
Public Const SND_MEMORY = &H4 ' lpszSoundName points to a memory file
Public Const SND_NODEFAULT = &H2 ' silence not default, if sound not
found
Public Const SND_NOSTOP = &H10 ' don't stop any currently playing sound
Public Const SND_SYNC = &H0 ' play synchronously (default)
After this declarrations, I tryed to call sndPlaySound function, and to set
flags parameter.
Private Sub Form_Load()
soundflags = SND_SYNC Or SND_NODEFAULT Or SND_NOSTOP or SND_LOOP Or SND_MEMORY
soundarray = LoadResData (101, "WAVE")
sndPlaySound soundarray(0), soundflags
EndSub
ID of my resource is 101, and "WAVE" is the resource type.
Where is my problem?
Best regards
Darko!
Other related posts:
- » How to load custom resource? - Darko Pogačić