QB64.org Forum
Active Forums => QB64 Discussion => Topic started by: madscijr on February 02, 2022, 10:36:01 am
-
When using _FREEIMAGE, per the wiki
https://wiki.qb64.org/wiki/FREEIMAGE (https://wiki.qb64.org/wiki/FREEIMAGE)
Do not try to free image handles currently being used as the active SCREEN. Change screen modes first.
Is there some way to programmatically determine if a given image handle is currently being used as the active SCREEN?
I realize that whenever you change the SCREEN to a new image handle, you could manually set a variable to keep track, and check that before doing _FREEIMAGE,
but is there some built-in command to determine this without having to do that?
Much appreciated...
-
Print "The current screen is image("; r;
"), whose handle is:"; image
(r
);
"... <proven by using direct variables>."
The easiest way would just be to check if the handle is the same as the _DEST, _SOURCE, or _DISPLAY.
_DEST is where you're currently set to print text to. I don't think you can free that without causing issues.
_SOURCE is where you get information from if you use POINT, SCREEN, or whatnot. I don't think it can be freed either.
_DISPLAY is the handle of the currently active display.
Check against those 3 things, and if your current handle isn't one of them, then you're safe to free it.
-
The easiest way would just be to check if the handle is the same as the _DEST, _SOURCE, or _DISPLAY.
...
Check against those 3 things, and if your current handle isn't one of them, then you're safe to free it.
I didn't realize those could be read as values. That should answer my question - thanks!