Choose Tools - Components - Add Dll (Both) and add BinaryFile.dll.
Choose Tools - Add Object - BinaryFile and add the object.
See the manual: http://www.b4x.com/help/binaryfile/index.html for information on working with this library.
Thanks. Now it works... or at least compiles. But the data.dat file doesn't saver the files. :S
Don't know why. The code i have as follows:
B4X:
Sub Globals
End Sub
Sub App_Start
Form1.Show
End Sub
Sub Button1_Click
FileOpen(c1,Encaje.Text,cRandom)
bin.New1(c1,true)
End Sub
Sub Encajar_Click
bin.EmbedFile (AppPath & TextBox2.Text)
bin.EmbedFile (AppPath & "\aboutOk.png")
End Sub
Sub Button4_Click
FileClose(c1)
End Sub
I did ti, thanks. Now I can embed files in to a data.dat. Now the thing is, i have a series of images in the same data.dat. How can i retrieve them? I don't think this do the job:
Form1.Image = bin.RetrieveImage
Form1.DrawImage(bin.RetrieveImage,10,10)
I'm not sure what you want to achieve but this is what your code does:
Form1.Image = bin.RetrieveImage 'Makes the first image to be the background
Form1.DrawImage(bin.RetrieveImage,10,10) 'Draws the second image on the form at 10,10.
Note that you can use the ImageLib library for more drawing options.
In order to minimize memory load the Image Button just references to an image. It is best to retrieve images from a binary file into an ImageList control and assign images to Image Buttons, such as
B4X:
FileOpen(p1,"images.dat",cRandom)
bin.New1(p1,true)
For i= 0 To x
ImageList1.Add(bin.RetrieveImage)
Next
FileClose(p1)
ImageButton1.Image = ImageList1.Item(x)