how to insert sound in vb6 programming

Reply

Join Date: Jun 2007
Posts: 17
Reputation: paodzy is an unknown quantity at this point 
Solved Threads: 0
paodzy paodzy is offline Offline
Newbie Poster

how to insert sound in vb6 programming

 
0
  #1
Jul 11th, 2007
please help me how to make a background music in vb6.
Reply With Quote Quick reply to this message  
Join Date: Jul 2007
Posts: 12
Reputation: Naseem89 is an unknown quantity at this point 
Solved Threads: 0
Naseem89 Naseem89 is offline Offline
Newbie Poster

Re: how to insert sound in vb6 programming

 
0
  #2
Jul 14th, 2007
Hi, you can use this code:

Visual Basic 4 / 5 / 6 Syntax (Toggle Plain Text)
  1. 'First add the ActiveX MMControl
  2.  
  3. Option Explicit
  4.  
  5. Private Sub Form_Load()
  6.  
  7. Dim AppPath As String
  8.  
  9. 'Appointment of music file from within your program
  10.  
  11. If Right$(App.Path, 1) <> "\" Then
  12. AppPath = App.Path & "\Sound.wav"
  13. Else
  14. AppPath = App.Path & "Sound.wav"
  15. End If
  16.  
  17. 'Determine the type of music file
  18.  
  19. MMControl1.DeviceType = "waveaudio"
  20.  
  21. 'If the file type " MIDI "
  22. 'MMControl1.DeviceType = "Sequencer"
  23.  
  24. 'Determining file name
  25.  
  26. MMControl1.FileName = AppPath
  27. 'Opening the file
  28.  
  29. MMControl1.Command = "open"
  30. 'Reading file
  31.  
  32. MMControl1.Command = "play"
  33.  
  34. End Sub
  35.  
  36.  
  37. Private Sub MMControl1_Done(NotifyCode As Integer)
  38.  
  39. 'This event at the end of passage voice
  40.  
  41. 'Re-reading passage voice
  42. MMControl1.Command = "prev"
  43. 'Reading passage voice again
  44. MMControl1.Command = "play"
  45.  
  46. End Sub
Reply With Quote Quick reply to this message  
Join Date: Jun 2007
Posts: 21
Reputation: smiles is an unknown quantity at this point 
Solved Threads: 0
smiles's Avatar
smiles smiles is offline Offline
Newbie Poster

Re: how to insert sound in vb6 programming

 
0
  #3
Jul 16th, 2007
hi !!! could you tell me how to make this code point to exactly where the file located , for i.e, D:\...\sound.wav

Visual Basic 4 / 5 / 6 Syntax (Toggle Plain Text)
  1. AppPath = App.Path & "\Sound.wav"
Reply With Quote Quick reply to this message  
Join Date: Jul 2007
Posts: 12
Reputation: Naseem89 is an unknown quantity at this point 
Solved Threads: 0
Naseem89 Naseem89 is offline Offline
Newbie Poster

Re: how to insert sound in vb6 programming

 
0
  #4
Jul 16th, 2007
In the code by myself placing the music file is in the same folder that contains your program.
E.g:

If your program in this directory:- "D : \ My Project \ test.exe \", it must be the music file in the following directory :- "D : \ My Project \ song.wav"

I hope that this is clear.
Reply With Quote Quick reply to this message  
Join Date: Jul 2007
Posts: 12
Reputation: Naseem89 is an unknown quantity at this point 
Solved Threads: 0
Naseem89 Naseem89 is offline Offline
Newbie Poster

Re: how to insert sound in vb6 programming

 
0
  #5
Jul 16th, 2007
The inter ( app.path ) it means:

The music file, or any other file must be in the same program directory
Reply With Quote Quick reply to this message  
Join Date: Feb 2007
Posts: 2,094
Reputation: debasisdas will become famous soon enough debasisdas will become famous soon enough 
Solved Threads: 127
debasisdas's Avatar
debasisdas debasisdas is offline Offline
Postaholic

Re: how to insert sound in vb6 programming

 
0
  #6
Jul 17th, 2007
You can directly use the API PlaySound to do that .
No need to write all that code.
Last edited by debasisdas; Jul 17th, 2007 at 9:20 am.
Share your Knowledge.
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the Visual Basic 4 / 5 / 6 Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC