REQOPTIONS.CPP
Upload User: linklycbj
Upload Date: 2009-11-12
Package Size: 447k
Code Size: 2k
Category:

Windows Develop

Development Platform:

WINDOWS

  1. // ReqOptions.cpp : implementation file
  2. //
  3. #include "stdafx.h"
  4. #include "monitor.h"
  5. #include "ReqOptions.h"
  6. #include "RequestLog.h"
  7. #ifdef _DEBUG
  8. #define new DEBUG_NEW
  9. #undef THIS_FILE
  10. static char THIS_FILE[] = __FILE__;
  11. #endif
  12. /////////////////////////////////////////////////////////////////////////////
  13. // CReqOptions dialog
  14. CReqOptions::CReqOptions(CWnd* pParent /*=NULL*/)
  15. : CDialog(CReqOptions::IDD, pParent)
  16. {
  17. //{{AFX_DATA_INIT(CReqOptions)
  18. m_numlog = 0;
  19. //}}AFX_DATA_INIT
  20. }
  21. void CReqOptions::DoDataExchange(CDataExchange* pDX)
  22. {
  23. CDialog::DoDataExchange(pDX);
  24. //{{AFX_DATA_MAP(CReqOptions)
  25. DDX_Control(pDX, IDC_DEVLIST, m_ctlList);
  26. DDX_Control(pDX, IDB_NONE, m_ctlNone);
  27. DDX_Control(pDX, IDB_ALL, m_ctlAll);
  28. DDX_Text(pDX, IDC_NUMLOG, m_numlog);
  29. DDV_MinMaxInt(pDX, m_numlog, 1, 1000);
  30. //}}AFX_DATA_MAP
  31. }
  32. BEGIN_MESSAGE_MAP(CReqOptions, CDialog)
  33. //{{AFX_MSG_MAP(CReqOptions)
  34. ON_BN_CLICKED(IDB_ALL, OnAll)
  35. ON_BN_CLICKED(IDB_NONE, OnNone)
  36. //}}AFX_MSG_MAP
  37. END_MESSAGE_MAP()
  38. /////////////////////////////////////////////////////////////////////////////
  39. // CReqOptions message handlers
  40. BOOL CReqOptions::OnInitDialog() 
  41. { // CReqOptions::OnInitDialog
  42. CDialog::OnInitDialog();
  43. CenterWindow();
  44. for (int i = 0; i < m_devlist.GetSize(); ++i)
  45. { // populate list box
  46. PIOSDCB dcb = m_devlist[i];
  47. int index = m_ctlList.AddString(DriveName(dcb));
  48. m_ctlList.SetItemDataPtr(index, dcb);
  49. if (m_log->m_all)
  50. m_ctlList.SetSel(index);
  51. else
  52. for (int j = 0; j < m_log->m_devlist.GetSize(); ++j)
  53. if (dcb == m_log->m_devlist[j])
  54. { // currently selected
  55. m_ctlList.SetSel(index);
  56. break;
  57. } // currently selected
  58. } // populate list box
  59. return TRUE;  // return TRUE unless you set the focus to a control
  60.               // EXCEPTION: OCX Property Pages should return FALSE
  61. } // CReqOptions::OnInitDialog
  62. void CReqOptions::OnOK()
  63. { // CReqOptions::OnOK
  64. CDialog::OnOK();
  65. int nsel = m_ctlList.GetSelCount();
  66. int *sel = new int[nsel];
  67. m_ctlList.GetSelItems(nsel, sel);
  68. m_devlist.RemoveAll();
  69. for (int i = 0; i < nsel; ++i)
  70. m_devlist.Add((PIOSDCB) m_ctlList.GetItemDataPtr(sel[i]));
  71. delete [] sel;
  72. } // CReqOptions::OnOK
  73. void CReqOptions::OnAll() 
  74. {
  75. m_ctlList.SetSel(-1, TRUE);
  76. }
  77. void CReqOptions::OnNone() 
  78. {
  79. m_ctlList.SetSel(-1, FALSE);
  80. }