Edit control doesn't generate WM_COMMAND messages

旧巷老猫 提交于 2019-12-12 02:28:44

问题


I have an edit control. In the parent window I'm listening a WM_COMMAND message. But my control doesn't send it on change. Moreover, when I'm watching messages with Spy I can see only different keyboard messages on the edit control itself and the only message in the main parent window is WM_CTLCOLOREDIT.

P.S.: The only interesting thing I'm doing - I'm creating an edit with HWND_MESSAGE parent and assign a parent later with SetParent();


回答1:


For an edit control, notifications are sent to the original parent of the control. That is, in your case, the message only window.

In a comment to a similar question Raymond Chen says:

Many controls cache the original parent. Not much you can do about it.

You may be best postponing creation of the edit control until you have created its parent.



来源:https://stackoverflow.com/questions/22916895/after-changing-the-parent-of-a-child-window-with-setparent-the-child-window-sti

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!