It looks like a pretty clean example from what I can recall.
WinMain builds the window and starts the message pump. The pump is implement starting at line 425. It's basically a while loop that reads the next message on the stack, translates it, then sends it to the object it belongs to.
It's the precursor to today's modern event-driven designs. Basically, this is now done for you by the runtime.
The bulk of the action happens in the created window's "wndproc", cbMainWindow (Line 455 - 2897).
There's a giant switch statement, with each handled message being a separate case. There's also a WM_COMMAND message, which is essentially a message holding another message inside.
This is probably the best book on Win32 API programming out there.
Yes, it's unfortunate that Programming Windows after 5ed became about XAML and C#. Those are good tools, but it's sad that they stopped updating the Win32/C++ resources as well.
WinMain builds the window and starts the message pump. The pump is implement starting at line 425. It's basically a while loop that reads the next message on the stack, translates it, then sends it to the object it belongs to.
It's the precursor to today's modern event-driven designs. Basically, this is now done for you by the runtime.
The bulk of the action happens in the created window's "wndproc", cbMainWindow (Line 455 - 2897).
There's a giant switch statement, with each handled message being a separate case. There's also a WM_COMMAND message, which is essentially a message holding another message inside.
This is probably the best book on Win32 API programming out there.
https://www.amazon.com/Programming-Windows%C2%AE-Fifth-Devel...