SetParent之后Edit控件不向新的父窗口发送EN_CHANGE通知了。

duyanning 2005-11-16 05:50:30
sdk程序
在setparent之前,edit控件可以向父窗口发送EN_CHANGE通知,但setparent一个新的父窗口之后,edit控件不向新的父窗口发送EN_CHANGE通知,如果把edit换成button,倒是正常,可以收到BN_CLICKED.
不光EN_CHANGE,任何通知消息都没有。
...全文
205 6 打赏 收藏 转发到动态 举报
写回复
用AI写文章
6 条回复
切换为时间正序
请发表友善的回复…
发表回复
goodboyws 2005-11-17
  • 打赏
  • 举报
回复
加入了FAQ
goodboyws 2005-11-17
  • 打赏
  • 举报
回复
汗,分给你自己了,呵呵
duyanning 2005-11-16
  • 打赏
  • 举报
回复
答案用setparent edit wm_command作关键词在google搜到,去他娘的百度
duyanning 2005-11-16
  • 打赏
  • 举报
回复
http://support.microsoft.com/default.aspx?scid=KB;EN-US;Q104069
duyanning 2005-11-16
  • 打赏
  • 举报
回复
我已找到答案!
An edit, list box, or combo box control sends notifications to the original parent window even after SetParent has been used to change the control's parent. A button control sends notifications to the new parent after SetParent has been used to change its parent.

Edit, list box, and combo box controls keep a private copy of the window handle of the parent at the time of creation. This handle is not changed when SetParent is used to change the control's parent. Consequently, the notifications (EN_*, LBN_*, and CBN_* notifications) go to the original parent.

Note that WM_PARENTNOTIFY messages go to the new parent and GetParent() returns the new parent. If it is required that notifications go to the new parent window, code must be added to the old parent's window procedure to pass on the notifications to the new parent.

For example: case WM_COMMAND:
hwndCtl = LOWORD(lParam);

// If notification is from a control and the control is no longer this
// window's child, pass it on to the new parent.
if (hwndCtl && !IsChild(hWnd, hwndCtl))
SendMessage(GetParent(hwndCtl), WM_COMMAND, wParam, lParam);
else Do normal processing;

Button controls send notifications to the new parent after SetParent has been used to change the parent.
goodboyws 2005-11-16
  • 打赏
  • 举报
回复
不会是你的窗口过程写的有问题吧

15,980

社区成员

发帖
与我相关
我的任务
社区描述
VC/MFC 界面
社区管理员
  • 界面
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧