marcuslee
02-12-2009, 18:19
In trying to change the font of a particular label, I came across a thread from 2007 (http://community.thinbasic.com/index.php?topic=612.0). In that thread, Petr used an example with the following line:
DIM hFont1 AS DWORD resource = Font_Create("Courier New", 9)
I'm curious about the keyword "resource." I found a comment from Eros (http://community.thinbasic.com/index.php?topic=250.0)when he implemented this feature. He wrote:
New way to declare DWORD or LONG variables used to reference resources like fonts: DIM MyVar AS DWORD RESOURCE
If RESOURCE is specified after DWORD or LONG types, thinBasic will take care of resource release when scope of the variable will end.
Is there any other time that it would be good to use RESOURCE other than fonts? Does RESOURCE offer some advantage for any LONG or DWORD declaration?
Love thinBasic! :occasion:
Mark
DIM hFont1 AS DWORD resource = Font_Create("Courier New", 9)
I'm curious about the keyword "resource." I found a comment from Eros (http://community.thinbasic.com/index.php?topic=250.0)when he implemented this feature. He wrote:
New way to declare DWORD or LONG variables used to reference resources like fonts: DIM MyVar AS DWORD RESOURCE
If RESOURCE is specified after DWORD or LONG types, thinBasic will take care of resource release when scope of the variable will end.
Is there any other time that it would be good to use RESOURCE other than fonts? Does RESOURCE offer some advantage for any LONG or DWORD declaration?
Love thinBasic! :occasion:
Mark