Is there a way to define and send custom message types in Win32, to be caught by your Main message handler? For example, my main message handler captures messages such as WM_PAINT, WM_RESIZE, WM_LBUTTONDOWN etc. Can I create my own WM_DOSOMETHING? If so, how would I send this message?
Ah, I actually just discovered this was asked before here, however, it doesn’t answer how I would actually send this message.
Yes. Just declare a constant in the WM_USER range e.g.
You can also register a message by name using the RegisterWindowMessage API.
You can then send these messages using SendMessage, PostMessage or any of their variants.