随风飘荡012
2018-09-21 02:46
采纳率: 46.7%
浏览 637

winxp vc++6 MFC listctrl 双击不响应

.h
afx_msg void OnDblClk(NMHDR* pNMHDR, LRESULT* pResult);

.cpp
ON_NOTIFY(NM_DBLCLK, IDC_LIB_TEXT_LIST, OnDblClk)

void CTextLibDlg::OnDblClk(NMHDR* pNMHDR, LRESULT* pResult)
{
m_nTreeListIndex=-1;
CWnd cwnd;
cwnd.GetDlgItem(IDD_PRO_LABEL_PAGE);
m_hWnd=NULL;
m_hWnd=cwnd.GetSafeHwnd();
if (m_hWnd!=NULL)//判断标签窗口是否打开 多个相同ID对话框打开无效,需要父句柄
{

NMITEMACTIVATE* p = ( NMITEMACTIVATE* )pNMHDR;
UINT nState = m_TextList.GetItemState ( p->iItem, STATE_TREE_MASK );
if (( nState & STATE_ROOT_COLLAPSE ) == STATE_ROOT_COLLAPSE||
(nState & STATE_ROOT_EXPAND ) == STATE_ROOT_EXPAND)
{
m_nTreeListIndex++;
for (int i=0;i<nState;i++)
{
if ( ( nState & STATE_ROOT_COLLAPSE ) == STATE_ROOT_COLLAPSE||
(nState & STATE_ROOT_EXPAND ) == STATE_ROOT_EXPAND)
m_nTreeListIndex++;
}

    }

//  CTextLibDlg::OnDestroy();
}   

}

  • 写回答
  • 好问题 提建议
  • 追加酬金
  • 关注问题
  • 邀请回答

2条回答 默认 最新

相关推荐 更多相似问题