Using Binary.dll... how to?

Discussion in 'Questions (Windows Mobile)' started by Rod, Aug 14, 2007.

  1. Rod

    Rod Member

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

    Erel Administrator Staff Member Licensed User

  3. Rod

    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:

    Code:
    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?
     
  4. Rod

    Rod Member

    how can i creat I bin file then that contains a series of images?

    Thanks
     
  5. Erel

    Erel Administrator Staff Member Licensed User

    You're code seems right except of this line:
    bin.EmbedFile (AppPath & TextBox2.Text)

    You should probably change it to:
    bin.EmbedFile (AppPath & "\" & TextBox2.Text)
     
  6. Rod

    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: Aug 15, 2007
  7. Erel

    Erel Administrator Staff Member Licensed User

    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.
     
  8. Rod

    Rod Member

    Thanks!
     
    Last edited: Aug 15, 2007
  9. alexeew

    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: Dec 16, 2007
  10. alfcen

    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

    Code:
    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)
     
Loading...