What's the best way for me to keep 'information' with an instance of my custom control? Like at the moment, my controls have a class created on the WM_CREATE message and then I use SetWindowLong() to have a pointer to it. However, this makes the GWL_USERDATA useless for anything else ... and you can set it on the standard windows controls so that got me thinking that windows does it differently!
Now, the idea I'm working on now is to have an ever expanding array of a struct which uses the id and hwnd of a control as a unique id to store the class instance.. This way I can just search the array for the id and hwnd that match the control I'm painting and then retrieve the class pointer ...
Code:
typedef struct {
HWND hwnd;
int id;
LONG *ptr;
}CLASSINFOSTRUCT, *lpCLASSINFOSTRUCT;
That would be the struct, or at least something similar to that. And then on the WM_PAINT message I'd just search the array looking for the matching struct members and then typecast the long pointer to the class type.
And this would be entered into the dynamic array after the class instance is instatiated.
Is this feasable??