While messing with multithreaded, callbacks, win32 api functions and other nasty problems, I got an event with an idea. (Hehehe)
What if, instead of defining a global callback function (or static when designing a class), instead of DefWindowProc
for lpfnWndProc
assigned the value lpfnWndProc
when registering a window class and then running the entire event loop in a separate thread?
This way, I donβt need to crack this
problem when it implements a callback in the class and the main thread continues, freeing you from this loop left by God, allowing you to do anything, even open another window (yay!)
The "normal" way:
LRESULT CALLBACK WndProc(...) { ...
My newfound amazing way:
DWORD WINAPI MyAwesomeEventLoop(void* data)
What do you guys think?
source share