WM_CONTEXTMENU percolate upward

来源:互联网 发布:mac改壁纸 编辑:程序博客网 时间:2024/06/06 01:07

在学习Windows.Programming Windows with MFC, 2nd Edition时,看到第四章Menus的Menu Magic中的Context Menus小节。有一段话有些费解:

写道
If necessary, you can translate the screen coordinates passed in point into client coordinates with CWnd::ScreenToClient. It might seem curious that OnContextMenu receives a pointer identifying a window since mouse messages go to the window under the cursor. However, there's a reason. Unlike other messages, WM_CONTEXTMENU messages percolate upward through the window hierarchy if a right-click occurs in a child window (for example, a push button control) and the child window doesn't process the message. Therefore, if a window contains child windows, it could receive WM_CONTEXTMENU messages with pWnd containing a pointer to one of its children.

 多读了几遍,GOOGLE了一下,

 

http://newdata.box.sk/bx/c/htm/ch13.htm#Heading6

 

发现这篇文章有个“percolating upward”。呵呵,一下子明白了,不久是说“向上转型”吗。

 

相应的“percolate upward through”,不就是说“WM_CONTEXTMENU消息从子窗口传递到父窗口,子窗口执行该消息”。

 

 

 

 

原创粉丝点击