This is my code
'the API declaration that play Wav file
Private Declare Function sndPlaySound Lib "winmm.dll" Alias "sndPlaySoundA" _
(ByVal lpszSoundName As String, ByVal uFlags As Long) As Long
'the LoadDataIntoFile function
Public Sub LoadDataIntoFile(DataName As Integer, FileName As String)
Dim myArray() As Byte
Dim myFile As Long
If Dir(FileName) = "" Then
myArray = LoadResData(DataName, "CUSTOM")
myFile = FreeFile
Open FileName For Binary Access Write As #myFile
Put #myFile, , myArray
Close #myFile
End If
End Sub
Private Sub Form_Load()
'copy the Wav file to c:\tmpfile.$$$
LoadDataIntoFile 101, App.Path & "\bless.wav"
'Play the Wav file using the sndPlaySound API function
sndPlaySound App.Path & "\bless.wav", 1
End Sub
Private Sub Timer1_Timer()
Unload Me
Form2.Show
End Sub
That's the code for the First Form and this is for the second one..
'the API declaration that play Wav file
Private Declare Function sndPlaySound Lib "winmm.dll" Alias "sndPlaySoundA" _
(ByVal lpszSoundName As String, ByVal uFlags As Long) As Long
'the LoadDataIntoFile function
Public Sub LoadDataIntoFile(DataName As Integer, FileName As String)
Dim myArray() As Byte
Dim myFile As Long
If Dir(FileName) = "" Then
myArray = LoadResData(DataName, "CUSTOM")
myFile = FreeFile
Open FileName For Binary Access Write As #myFile
Put #myFile, , myArray
Close #myFile
End If
End Sub
Private Sub Form_Load()
'copy the Wav file to c:\tmpfile.$$$
LoadDataIntoFile 102, App.Path & "\Rock.mp3"
'Play the Wav file using the sndPlaySound API function
sndPlaySound App.Path & "\Rock.mp3", 1
End Sub
My Problem is the Second Form it copys the wav file to my appplication but i doesnt run or i dont hear the sound i think there is a problem in the
what should i change there?