在响应CTabCtrl控件的SelectChange消息时有响应函数OnSelchangeTab(NMHDR* pNMHDR, LRESULT* pResult).
我如何通过pNMHDR知道是选择了那个标签?

解决方案 »

  1.   

    可以通过pNMHDR的hwndFrom获得控件的句柄,然后调用GetCurSel获得选中的标签。或者放弃pNMHDR参数,直接GetDlgItem(控件ID)获得控件句柄,然后调用GetCurSel。
      

  2.   

    这个结构里不能得到选择了哪个标签,应该用GetCurSel获得选中的标签.这个结构保存了TAB控件的句柄、ID以及消息码TCN_SELCHANGE 
        lpnmhdr = (LPNMHDR) lParam; Parameters
    lpnmhdr 
    Address of an NMHDR structure. The hwndFrom member is the handle to the tab control. The idFrom member is the child window identifier of the tab control. The code member is TCN_SELCHANGE.