问题
The documentation for WM_NOTIFY is easy enough to find, however I'm finding a fair amount of sample code and articles that refer to WM_REFLECT_NOTIFY
, for which I can't find any documentation.
What is WM_REFLECT_NOTIFY
, where can I find the documentation for it and how is this message different from WM_NOTIFY
?
Example references:
- Flickering in listview with ownerdraw and virtualmode
- ListViewSubItem.Bounds almost works
回答1:
WM_REFLECT_NOTIFY
is referred to as having value of 0x204E
, that is 0x2000
+ WM_NOTIFY
. Typical use of message reflection is to send back notification to its origin so that supposedly subclassed control could handle notification itself.
Hence the knowledge you are possibly missing and looking documentation for is that the control sends WM_NOTIFY
to its parent in a regular way. And the parent does SendMessage
with the same message parameters back to the control using message number 0x2000
+ original Msg
. The meaning of the parameters wParam
, lParam
is supposed to be the same of original message (WM_NOTIFY
in your case).
The constant 0x2000
might possibly vary from framework to framework or be otherwise private agreement between controls and hosting windows.
MFC and ActiveX controls, for instance, reflect WM_NOTIFY
messages making them OCM_NOTIFY
messages, where (olectl.h):
#define OCM_NOTIFY (OCM__BASE + WM_NOTIFY)
#define OCM__BASE (WM_USER+0x1c00)
and finally (winuser.h):
#define WM_USER 0x0400
That is, the OCM_NOTIFY
is 0x204E
, just as your WM_REFLECT_NOTIFY
. The MSDN docs on those from here: Reflected Window Message IDs.
来源:https://stackoverflow.com/questions/10637133/wm-reflect-notify-vs-wm-notify