View Single Post
Old Jul 29th, 2006, 8:23 PM   #18
Booooze
Expert Programmer
 
Booooze's Avatar
 
Join Date: Mar 2006
Location: Igloo
Posts: 710
Rep Power: 3 Booooze is on a distinguished road
Send a message via MSN to Booooze
Judging by your code, It looks like you are using a different version of windows media player than I am. You have to be running 2000 or higher I think in order to use WMP v9. Regardless, here is the code I used. All it does is extracts the resource file (the song) to the location of the executable. It then plays the song. I don't see what is so hard about it that you can't grasp. Like I said, I think you are using a different version of WMP.

vb Syntax (Toggle Plain Text)
  1. 'Declare a buffer to store the
  2. 'contents of the resource file
  3. Dim strBuff As String
  4. Dim strFile As String
  5.  
  6. 'Create a temp file name
  7. strFile = App.Path & "\MyTempSong.mp3"
  8.  
  9. 'Extract the file from the resource file
  10. strBuff = StrConv(LoadResData("SONG", "MP3"), vbUnicode)
  11.  
  12. 'Save the string as a file
  13. Open strFile For Output As #1
  14. Print #1, strBuff
  15. Close #1
  16.  
  17.  
  18.  
  19. Wmp.URL = App.Path & "\MyTempSong.mp3" ' load song
  20. Wmp.Controls.play 'play the song
  21.  
  22.  
  23. 'Delete your temp file
  24. 'Kill strFile
Booooze is offline   Reply With Quote