惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

Martin Fowler
Martin Fowler
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
IT之家
IT之家
美团技术团队
酷 壳 – CoolShell
酷 壳 – CoolShell
Y
Y Combinator Blog
T
Tailwind CSS Blog
D
Docker
博客园 - Franky
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
Google DeepMind News
Google DeepMind News
腾讯CDC
Vercel News
Vercel News
Engineering at Meta
Engineering at Meta
U
Unit 42
The Cloudflare Blog
S
SegmentFault 最新的问题
WordPress大学
WordPress大学
爱范儿
爱范儿
Recent Announcements
Recent Announcements
博客园 - 聂微东
博客园 - 叶小钗
H
Help Net Security
MyScale Blog
MyScale Blog

博客园 - 想飞

区块链应用场景 系统微服务架构 shell sed命令 项目pom.xml第一行报错解决方案 Fabric事务机制 MSP成员服务管理 Dockerfile 说明 Docker-Compose 配置详解 Fabric 术语 Docker数据管理:Named volume Mac 查看Volumes Android中的JSON详细总结 经典黑客程序gh0st汇编改写 关于使用WM_COPYDATA进行进程之间交换数据的问题 关于金山开源界面BkWin不能使用DDX 的解决办法 使用#define定义引用的编译问题 WTL中CListViewCtrl中LVS_ICON和LVS_REPORT模式的不同 浏览器研究 图片合并工具V1.1
CListBox没产生LBN_SELCHANGE消息
想飞 · 2011-08-19 · via 博客园 - 想飞

WTL中,定义CListBox的消息接收。 

COMMAND_HANDLER_EX(IDB_HOME_DICT_KEY_LIST,LBN_SELCHANGE, OnListItemchanged)

死活都没有触发到 LBN_SELCHANGE 的消息。

开始以为是消息订阅的问题。

后来用接收所有消息的宏 

用COMMAND_ID_HANDLER_EX(IDB_HOME_DICT_KEY_LIST, OnListItemMsg) 

发现只看到有得到焦点和失去焦点的消息产生。

后查MSDN。

This notification message is not sent if the LB_SETCURSEL message changes the selection.

This notification message applies only to a list box that has the LBS_NOTIFY style.

For a multiple-selection list box, the LBN_SELCHANGE notification is sent whenever the user presses an arrow key, even if the selection does not change.  

原来需要设置style为 

LBS_NOTIFY

后来修改为: 

m_pKeyList = new CListBox;

m_pKeyList->Create(m_dlg->GetViewHWND(),

NULL,

NULL,

WS_VISIBLE | WS_CHILDWINDOW |  LBS_NOTIFY ,

0,IDB_HOME_DICT_KEY_LIST);

 终于能收到 

LBN_SELCHANGE。