SelDrvDlg.cpp
资源名称:DXGuide.zip [点击查看]
上传用户:wymy58
上传日期:2007-01-07
资源大小:2086k
文件大小:2k
源码类别:
DirextX编程
开发平台:
Visual C++
- // SelDrvDlg.cpp : implementation file
- //
- #include "stdafx.h"
- #include "PFM.h"
- #include "SelDrvDlg.h"
- #ifdef _DEBUG
- #define new DEBUG_NEW
- #undef THIS_FILE
- static char THIS_FILE[] = __FILE__;
- #endif
- /////////////////////////////////////////////////////////////////////////////
- // CSelDrvDlg dialog
- CSelDrvDlg::CSelDrvDlg(CWnd* pParent /*=NULL*/)
- : CDialog(CSelDrvDlg::IDD, pParent)
- {
- //{{AFX_DATA_INIT(CSelDrvDlg)
- // NOTE: the ClassWizard will add member initialization here
- //}}AFX_DATA_INIT
- m_strPath = "";
- }
- void CSelDrvDlg::DoDataExchange(CDataExchange* pDX)
- {
- CDialog::DoDataExchange(pDX);
- //{{AFX_DATA_MAP(CSelDrvDlg)
- DDX_Control(pDX, IDC_CDCOMBO, m_combCd);
- //}}AFX_DATA_MAP
- }
- BEGIN_MESSAGE_MAP(CSelDrvDlg, CDialog)
- //{{AFX_MSG_MAP(CSelDrvDlg)
- ON_CBN_SELCHANGE(IDC_CDCOMBO, OnSelchangeCdcombo)
- //}}AFX_MSG_MAP
- END_MESSAGE_MAP()
- /////////////////////////////////////////////////////////////////////////////
- // CSelDrvDlg message handlers
- void CSelDrvDlg::OnSelchangeCdcombo()
- {
- // TODO: Add your control notification handler code here
- int nItem = m_combCd.GetCurSel();
- if (nItem == CB_ERR)
- m_combCd.GetWindowText(m_strPath);
- else
- m_combCd.GetLBText(nItem, m_strPath);
- CDialog::OnOK();
- }
- BOOL CSelDrvDlg::OnInitDialog()
- {
- CDialog::OnInitDialog();
- // TODO: Add extra initialization here
- CString root;
- for (char cDrv='A'; cDrv<='Z'; cDrv++)
- {
- root = cDrv;
- root += ":\";
- switch(GetDriveType(root))
- {
- case DRIVE_REMOVABLE:
- case DRIVE_FIXED:
- case DRIVE_REMOTE:
- case DRIVE_CDROM:
- case DRIVE_RAMDISK:
- m_combCd.AddString(root.Left(2));
- break;
- }
- }
- m_combCd.SetCurSel(m_combCd.FindString(-1, m_strPath.Left(2)));
- return TRUE; // return TRUE unless you set the focus to a control
- // EXCEPTION: OCX Property Pages should return FALSE
- }
- void CSelDrvDlg::OnOK()
- {
- // TODO: Add extra validation here
- m_combCd.GetWindowText(m_strPath);
- CDialog::OnOK();
- }