Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

 
 
Thread Tools Display Modes
Prev Previous Post in Thread   Next Post in Thread Next
Old Jul 14th, 2006, 1:57 PM   #11
Darcksky
Newbie
 
Join Date: May 2006
Posts: 18
Rep Power: 0 Darcksky is on a distinguished road
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

,  1
what should i change there?
Darcksky is offline   Reply With Quote
 

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 3:01 AM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC