关于编辑框输入焦点的问题

善古 2011-04-06 09:48:13
VC2003
基于对话框工程

为编辑框添加EN_SETFOCUS事件处理函数,但鼠标点击编辑框后,
编辑框对这个事件没有响应.也就是没有运行到这个函数里面.

这是怎么回事呢?
...全文
112 5 打赏 收藏 转发到动态 举报
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
善古 2011-04-06
  • 打赏
  • 举报
回复
BOOL CdemoDlg::PreTranslateMessage(MSG* pMsg)
{
if(pMsg-> message == WM_COMMAND)//这里不会进来是怎么回事呢
{
}
}

[Quote=引用 2 楼 visualeleven 的回复:]

Sent when an edit control receives the keyboard focus. The parent window of the edit control receives this notification message through a WM_COMMAND message.
[/Quote]
善古 2011-04-06
  • 打赏
  • 举报
回复
是不是因为编辑框所处在的窗口的父窗口添加了:virtual BOOL OnCommand(WPARAM wParam, LPARAM lParam);
或者说窗口类添加了WM_COMMAND消息啊..??能不能给个适合中国人看的帮助啊.

[Quote=引用 2 楼 visualeleven 的回复:]

Sent when an edit control receives the keyboard focus. The parent window of the edit control receives this notification message through a WM_COMMAND message.
[/Quote]
Eleven 2011-04-06
  • 打赏
  • 举报
回复
Sent when an edit control receives the keyboard focus. The parent window of the edit control receives this notification message through a WM_COMMAND message.
King_hhuang 2011-04-06
  • 打赏
  • 举报
回复
你的消息映射是用向导添加的吗,都添加完全了没有啊
应该不会这样的啊
善古 2011-04-06
  • 打赏
  • 举报
回复
BOOL CLoginWndDlg::PreTranslateMessage(MSG* pMsg)
{

if(pMsg-> message == WM_LBUTTONUP)
{
if(GetFocus() == GetDlgItem(IDC_EDITUSER))
{
//做事....
}
}
}

谢谢大家....

15,979

社区成员

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

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