Using Binary.dll... how to?

Rod

Member
I'm having trouble. How can i add a reference to BinaryFile.dll and then create an object of this type?
 

Rod

Member
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
Any ideas?
 

Rod

Member
Thanks!!

Thanks!!!

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)

Thanks again tho
 
Last edited:

alexeew

Member
This don't work with ImageButton

ImageButton1.Image = bin.RetrieveImage

Why ?

That work!!!
Image1.Image = bin.RetrieveImage
ImageButton1.Image = Image1.Image
 
Last edited:

alfcen

Well-Known Member
Licensed User
Hello Alex

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)
 
Top