QB64 Team Software => InForm Discussion => Topic started by: JohnJames on May 29, 2020, 09:07:32 am
Title: Using BASIMAGE to embed images in InForm EXEs
Post by: JohnJames on May 29, 2020, 09:07:32 am
Loving InForm. So good.
Placing an image is done by a link. If the EXE is run on another PC, that image path is lost and the EXE runs with a 'Missing Image' link error in its placeholder. In other words, the images are not embedded within the EXE.
Using 'BASIMAGE' in the QB64 code seems to be a possible way. It works perfectly in a separate QB64-only program but, in a QB64 program generated using InForm, it just doesn't work. Something to do with InForm constantly refreshing its canvas at run time 30 times a second?
Thanks, John.
Title: Re: Using BASIMAGE to embed images in InForm EXEs
Post by: FellippeHeitor on May 29, 2020, 10:20:38 am
Hello, there.
I actually use a variant of BASIMAGE I had come up with before Dav dropped his official solution, so it is possible.
Since you won't be loading the image with the default method, there's a bit of a hack involved to get it working.
Say you have a control named PictureBox1 and you want to place an image you loaded using BASIMAGE, so you already have a valid image handle called img&, and you know beforehand your image is 16x16 pixels:
Yep, it is incredible what Fellippe does. It's all hobby work (he has a job (if not more than one), and a young family). I just do not know how he does it. [But by now, he will be fed up with my plaudits].
Title: Re: Using BASIMAGE to embed images in InForm EXEs
Post by: SpriggsySpriggs on June 02, 2020, 03:14:50 pm
I made a program that utilizes Dav's BASFILE and BASIMAGE programs that he wrote. I combined them both into a program that I call BIN2INCLUDE. It generates a file that you $INCLUDE at the end of your program to use/create later. The PIC2MEM option uses Dav's code with some tweaks by me so that the program generates a function named after the encoded image so you can call the function as an image handle using that Control(ControlId).HelperCanvas picture control. It works pretty good. Here is the link to the program. It uses InForm as well. Enjoy! https://github.com/SpriggsySpriggs/BIN2INCLUDE (https://github.com/SpriggsySpriggs/BIN2INCLUDE) An example of how to use it: