The Win Window API gives you Set / GetProperty (), which allows you to define a pointer to everything you need (i.e. your own window object). However, from experience I know that it is rather slow.
Another possibility is to use a map in which the Win API window pointer is used as keys and the value is your window object. It is much faster, but where do you put this map if you do not have any global variables?
As suggested by Samuel, singleton allows you to get an object that is almost the same as global. Then you can get your window object using the Win API window pointer as a key, and it will return your object.
This is necessary to map incoming events to your window objects. Everything else, in any case, should be done the other way around (as you would expect, call functions only on your window object, which appears just like system windows.)
Why aren't you using Qt? it is already in C ++, and you do not need to worry about these details ...
Alexis wilke
source share