Inside Our Control
_SB_WndProc is a standard main window messaging procedure, that handles specific
WM_ messages for our SimpleButton control. We have complete control over what messages are handled but we also have responsibility to handle specific messages, as we are implementing the core code ourselves and have to handle painting, mouse & keyboard interaction, and other features.
We wont cover all the messages implemented in the
_SB_WndProc, see the code for the full SimpleButton project on github if you wish to see more detail. We will cover a few important messages that the control handles.
Note: windows messages that we don't specify or include wont be handled. This is different from subclassing controls, where you can safely call the DefWindowProc for windows to handle messages that you have no interest in, and override only the ones you are interested in. In our control we do not have that luxury of letting windows handle the default messaging, instead it is expected that our control will do all the work.
For example if you wish to handle keyboard interaction for your control you will need to provide for that, and possibly handle some of the following messages:
WM_SYSKEYUP. See the Microsoft documentation About Keyboard Input for more details.
Similary if you wish to handle mouse interaction for your control you will need to possibly handle some of the following message:
WM_CONTEXTMENU. See the Microsoft documentation About Mouse Input for more details.
The Microsoft documentation also has a list of System Defined Messages that may prove useful to refer to.