Using Macros To Get/Set Properties
Last updated
Was this helpful?
Last updated
Was this helpful?
When I was using the earlier technique of allocating as much bytes as I wanted in cbWndExtra
(without realising or coming across any downsides) I used a series of macros to help get/set the variables and constants to help define the offsets the macro would get/set, for example:
With the constants defined and appropriate named (using a prefix of '@') we could then define macros to get and set our property values. Each constant is an offset into the extra window bytes allocated by cbWndExtra
during the control's registration via .
The macros then called the or to get or set the value at the appropriate index offset.
Here is and example of some macros used to get and set the various 'properties' as defined above as constants:
The macros could then be placed in code and used like so:
Using macros to get and set our control's properties is still a valid technique if the amount of data store for these properties is less than 40 bytes (see the section and for why).
It is also possible to make use of the / api calls, which make use of - which is faster than / with a , but use of / with both atoms types are still slower than / as far as I am aware.