I'm creating a WinAPI / OpenGL wrapper class, and I'm wondering how to handle WndProc. How can you pass a pointer to it? Can it be a class function? Give me any ideas you have! Thanks!
I'm creating a WinAPI / OpenGL wrapper class, and I'm wondering how to handle WndProc. How can you pass a pointer to it? Can it be a class function? Give me any ideas you have! Thanks!
Do not make direct eye contact with me.
well, winproc is just a function pointer in the first place, so you can actually add it to your class if you so choose. and to call a pointer to it , just use WNDPROC * :P.
Some pretty good examples over Here.
Basically, the windows procedure needs to be a static method to work correctly, but this is rather inconvenient as a static method has no this pointer. It also means you can only call static member variables of your class.
To get around this, you need to have a static message router. Basically a static version of the windows procedure that will route messages to a non-static version of your windows procedure.
There are a number of examples in the thread above.