示例#1
0
//***************************************************************************************
void CBCGPFileDialog::OnItemDblClick ()
{
	ASSERT (m_nPage != BCGFileOpen);

	CListCtrl& list = (m_nPage == BCGFileRecent) ? m_wndRecentList : m_wndNewList;
	int iSelIndex = list.GetNextItem (-1, LVNI_ALL | LVNI_SELECTED);

	if (iSelIndex == -1)
	{
		return;
	}

	if (m_nPage == BCGFileRecent)
	{
		CString strPath = list.GetItemText (iSelIndex, 1);
		CString strName = list.GetItemText (iSelIndex, 0);

		if (strPath.IsEmpty ())
		{
			m_strRecentFilePath = strName;
		}
		else
		{
			m_strRecentFilePath = strPath;
			m_strRecentFilePath += _T('\\');
			m_strRecentFilePath += strName;
		}
	}
	else
	{
		ASSERT (m_nPage == BCGFileNew);
		m_iNewItemIndex = iSelIndex;
	}
	
	CDialog* pWnd = (CDialog*) GetParent();
	ASSERT (pWnd != NULL);

	pWnd->EndDialog (IDOK);
}