Define your own WM message for Message Pump in C ++

How to define your own WM message (e.g. WM_CLOSE, etc.) that can be processed by a C ++ message pump?

If possible even.

+5
source share
3 answers

It depends on what you are using the message for. This link shows a breakdown of the "address space" for Win32 messages.

WM_USER . WM_USER " . , , ".

, WM_APP.

RegisterWindowMessage , , . " , , ", RegisterWindowMessage, .

+6

, , , WM_USER:

#define WM_MY_MESSAGE (WM_USER + 1000)

ON_COMMAND/ON_NOTIFY.

, , . - .

, RegisterWindowMessage.

/ .

+2

You can use "RegisterWindowMessage" to create new unique messages.

from MSDN: "The RegisterWindowMessage function defines a new window message that is guaranteed to be unique throughout the system. The message value can be used when sending or sending messages."

+1
source

All Articles