www.pudn.com > 人体步态跟踪识别bate版.rar > ChooseDirDlg.cpp


// ChooseDirDlg.cpp : implementation file 
// 
 
#include "stdafx.h" 
#include "humantrack.h" 
#include "ChooseDirDlg.h" 
 
#ifdef _DEBUG 
#define new DEBUG_NEW 
#undef THIS_FILE 
static char THIS_FILE[] = __FILE__; 
#endif 
 
///////////////////////////////////////////////////////////////////////////// 
// CChooseDirDlg dialog 
 
 
CChooseDirDlg::CChooseDirDlg(CWnd* pParent /*=NULL*/) 
	: CDialog(CChooseDirDlg::IDD, pParent) 
{ 
	//{{AFX_DATA_INIT(CChooseDirDlg) 
		// NOTE: the ClassWizard will add member initialization here 
		m_str = _T(""); 
	//}}AFX_DATA_INIT 
} 
 
 
void CChooseDirDlg::DoDataExchange(CDataExchange* pDX) 
{ 
	CDialog::DoDataExchange(pDX); 
	//{{AFX_DATA_MAP(CChooseDirDlg) 
		// NOTE: the ClassWizard will add DDX and DDV calls here 
	DDX_Control(pDX, IDC_DIRECTORY_NAME, m_DirName); 
	DDX_Control(pDX, IDC_DIRECTORY_TREE, m_DirTree); 
	DDX_Control(pDX, IDC_DRIVE_COMBO, m_DriveList); 
	DDX_Text(pDX, IDC_DIRECTORY_NAME, m_str); 
	//}}AFX_DATA_MAP 
} 
 
 
BEGIN_MESSAGE_MAP(CChooseDirDlg, CDialog) 
	//{{AFX_MSG_MAP(CChooseDirDlg) 
	ON_CBN_SELCHANGE(IDC_DRIVE_COMBO, OnSelchangeDriveCombo) 
	//}}AFX_MSG_MAP 
END_MESSAGE_MAP() 
 
///////////////////////////////////////////////////////////////////////////// 
// CChooseDirDlg message handlers 
 
void CChooseDirDlg::OnSelchangeDriveCombo()  
{ 
	// TODO: Add your control notification handler code here 
		int     nSelected = 0; 
	CString szText; 
 
	// 确定新盘符,判断是否有效 
	nSelected = m_DriveList.GetCurSel(); 
	if (!m_DriveList.IsDriveReady(nSelected)) 
	{ 
		// 盘符无效,回复到前一个 
		m_DriveList.ResetDrive(m_DirTree.GetCurrentDrive()); 
		return; 
	} 
	// 获取盘符,并重新设置目录树 
	m_DriveList.GetLBText(nSelected, szText); 
	m_DirTree.SetCurrentDrive(szText[0]); 
 
	// 重新初始化目录树 
	m_DirTree.Initialize(); 
	m_DirName.SetWindowText(m_DirTree.GetCurrentDir());	 
 
} 
 
void CChooseDirDlg::OnOK()  
{ 
	// TODO: Add extra validation here 
    LPSTR path; 
    m_str=m_DirName.GetLine(0,path); 
	CDialog::OnOK(); 
} 
 
BOOL CChooseDirDlg::PreTranslateMessage(MSG* pMsg)  
{ 
	// TODO: Add your specialized code here and/or call the base class 
		if (WM_USER_PATHCHANGED == pMsg->message) 
	{ 
		m_DirName.SetWindowText(m_DirTree.GetCurrentDir()); 
		//OnPathChanged(); 
		return TRUE; 
	} 
	return CDialog::PreTranslateMessage(pMsg); 
} 
 
BOOL CChooseDirDlg::OnInitDialog()  
{ 
	CDialog::OnInitDialog(); 
	 
	// TODO: Add extra initialization here 
		// 在树视控件中创建图象列表 
	CImageList * pImageList; 
	//CImageList  pImageList; 
	pImageList = new CImageList(); 
	pImageList->Create(16, 16, ILC_COLOR, 4, 4); 
	//pImageList.Create(16, 16, ILC_COLOR, 4, 4); 
 
	// 导入位图,必须在CDirectoryTree对象初始化之前进行 
	CBitmap	bBitmap; 
	for (int nID = IDB_FIRST_TREE_ICON; nID <= IDB_LAST_TREE_ICON; nID++) 
	{ 
		bBitmap.LoadMappedBitmap(nID); 
		pImageList->Add(&bBitmap, (COLORREF)0x000000); 
		//pImageList.Add(&bBitmap, (COLORREF)0x000000); 
		bBitmap.DeleteObject(); 
	} 
	m_DirTree.SetBitmapList(pImageList); 
    //m_DirTree.SetBitmapList(&pImageList); 
 
	// 初始化 
	m_DriveList.Initialize(); 
	m_DirTree.Initialize(); 
	m_DirName.SetWindowText(m_DirTree.GetCurrentDir()); 
 
	return TRUE;  // return TRUE unless you set the focus to a control 
	              // EXCEPTION: OCX Property Pages should return FALSE 
}