编辑控件不会生成WM_COMMAND消息 [英] Edit control doesn't generate WM_COMMAND messages

查看:99
本文介绍了编辑控件不会生成WM_COMMAND消息的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个编辑控件.在父窗口中,我正在监听WM_COMMAND消息.但是我的控件不会在更改时发送它.此外,当我使用Spy观看消息时,在编辑控件本身上只能看到不同的键盘消息,而在主父窗口中唯一的消息是WM_CTLCOLOREDIT.

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 .:我正在做的唯一一件有趣的事情-我正在创建HWND_MESSAGE父级的编辑,稍后再使用SetParent();

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();

推荐答案

对于编辑控件,通知将发送到该控件的原始父级.也就是说,在您的情况下,仅消息窗口.

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.

这篇关于编辑控件不会生成WM_COMMAND消息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆