Binary Resource Files

Neodammer
04-03-2002, 01:13 PM
I used to remember, but anybody know how I can take for example a .mp3 from a resource file and "Properly" create a file named "music.mp3" ? Here is my code and i know this won't work for many reasons

Open App.Path & "\music.mp3" For Output As #1
Print #1, LoadResData(101, "CUSTOM")

Close #1

Neodammer
04-03-2002, 01:29 PM
I figured it out using this...


Public Sub LoadDataIntoFile(DataName As Integer, FileName As String)
Dim myArray() As Byte
Dim myFile As Long
If Dir(FileName) = "" Then
myArray() = LoadResData(101, "CUSTOM")
myFile = FreeFile
Open FileName For Binary Access Write As #myFile
Put #myFile, , myArray
Close #myFile
End If
End Sub

Private Sub Form_Load()
LoadDataIntoFile 101, App.Path & "\music.mp3"
MediaPlayer1.Open App.Path & "\music.mp3"

End Sub

................


I do wonder though ...hmm you think I can use that function to pull out several mp3's out of resource ?

Squirm
04-03-2002, 01:42 PM
I believe so... however, I dont think it is advisable to make huge resource files. They are mainly designed for storing a few small graphics and other data needed by the program. :-\

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum