zoukankan      html  css  js  c++  java
  • CListBox没产生LBN_SELCHANGE消息

    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。

  • 相关阅读:
    ISC2016训练赛 phrackCTF--Classical CrackMe
    JCTF 2014 小菜一碟
    攻防世界--ReverseMe-120
    lstm torch
    pandas 处理 纽约签到数据集
    python datatime
    tf.keras 模型 多个输入 tf.data.Dataset
    python **kwarg和*args
    java 优先队列 大根堆
    python总结
  • 原文地址:https://www.cnblogs.com/wantfly/p/CListBox.html
Copyright © 2011-2022 走看看