我需要动态生成一组CButton未知个数这个已经搞定其间,还需要指定它们的点击事件。这个就头疼了。这点击事件本为相同的事件,不过需要有一个为整数的参数不同。。更加头疼
比如
CButton[ 0 ].OnClick
CButton[ 1 ].OnClick
CButton[ 2 ].OnClick
CButton[ 3 ].OnClick
...
...
CButton[ i ].OnClick
需要得到这个I值作为那个共用点击事件的(内/外)参数。可以用什么办法获得或者在构造的时候就处理好?
将不胜感谢
此致
敬礼。

解决方案 »

  1.   

    ON_CONTROL_RANGEUse this macro to map a contiguous range of control IDs to a single message handler function for a specified Windows notification message, such as BN_CLICKED.ON_CONTROL_RANGE(wNotifyCode, id1, id2, memberFxn )
      

  2.   

    自己新建一个基类是CButton的类,给该类添加你想要的点击消息响应(如单击、双击等)。动态创建的时候Create刚才的那个类
      

  3.   

    对于按钮来说,ON_COMMAND_RANGE(id1,id2,memberfun)即可