11-03-2024, 02:39 AM
(11-02-2024, 11:32 PM)Ikerkaz Wrote:(11-02-2024, 11:25 PM)bplus Wrote: To reuse same imagehandle& number:
If imagehandle& < -1 then ' it contains an image
_freeimage imagehandle&
end if
imagehandle& = _LoadImage( ) ' load imagehandle& for reuse
Just do the first thing before each time you do the 2nd thing.
Thank you for your reply. But the wiki says in _FREEIMAGE " Note that calling _FREEIMAGE only frees the handle. It does NOT reset the variable used to store the handle back to 0."
I tried an example loading an image, its handle was -9 (for example), and after calling _FREEIMAGE its handle was -9... how can I know that I have freed the image? Maybe resetting manually the variable to 0?
If you need to reset that variable, you can do as bplus is suggesting and add this:
Code: (Select All)
If imagehandle& < -1 then _freeimage imagehandle&: imagehandle& = 0 'reset the handle to 0 after you free it