Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

121 lines
2.6 KiB

  1. // DhcpEximListDlg.cpp : implementation file
  2. //
  3. #include "stdafx.h"
  4. #include "dhcpeximx.h"
  5. extern "C" {
  6. #include <dhcpexim.h>
  7. }
  8. #include "DhcpEximListDlg.h"
  9. #ifdef _DEBUG
  10. #define new DEBUG_NEW
  11. #undef THIS_FILE
  12. static char THIS_FILE[] = __FILE__;
  13. #endif
  14. /////////////////////////////////////////////////////////////////////////////
  15. // DhcpEximListDlg dialog
  16. DhcpEximListDlg::DhcpEximListDlg(CWnd* pParent /*=NULL*/, PDHCPEXIM_CONTEXT Ctxtx , DWORD IDD)
  17. : CDialog(IDD, pParent)
  18. {
  19. //{{AFX_DATA_INIT(DhcpEximListDlg)
  20. m_Message = _T("");
  21. //}}AFX_DATA_INIT
  22. m_PathName = Ctxtx->FileName;
  23. m_fExport = Ctxtx->fExport;
  24. Ctxt = Ctxtx;
  25. CString Str1(_T("&Select the scopes that will be exported to ") );
  26. CString Str2(_T("&Select the scopes that will be imported from ") );
  27. CString PathNameStr(m_PathName);
  28. CString Dot(_T("."));
  29. // TODO: Add extra initialization here
  30. if( m_fExport )
  31. {
  32. m_Message = Str1 + PathNameStr + Dot;
  33. }
  34. else
  35. {
  36. m_Message = Str2 + PathNameStr + Dot;
  37. }
  38. }
  39. void DhcpEximListDlg::DoDataExchange(CDataExchange* pDX)
  40. {
  41. CDialog::DoDataExchange(pDX);
  42. //{{AFX_DATA_MAP(DhcpEximListDlg)
  43. DDX_Control(pDX, IDC_LIST1, m_List);
  44. DDX_Text(pDX, IDC_STATIC_ACTION, m_Message);
  45. //}}AFX_DATA_MAP
  46. }
  47. BEGIN_MESSAGE_MAP(DhcpEximListDlg, CDialog)
  48. //{{AFX_MSG_MAP(DhcpEximListDlg)
  49. ON_BN_CLICKED(IDOK, OnOk)
  50. ON_BN_CLICKED(IDCANCEL, OnCancel)
  51. //}}AFX_MSG_MAP
  52. END_MESSAGE_MAP()
  53. /////////////////////////////////////////////////////////////////////////////
  54. // DhcpEximListDlg message handlers
  55. BOOL DhcpEximListDlg::OnInitDialog()
  56. {
  57. CDialog::OnInitDialog();
  58. for ( DWORD i = 0; i < Ctxt->nScopes; i ++ )
  59. {
  60. m_List.InsertItem(i, Ctxt->Scopes[i].SubnetName );
  61. }
  62. return TRUE; // return TRUE unless you set the focus to a control
  63. // EXCEPTION: OCX Property Pages should return FALSE
  64. }
  65. void DhcpEximListDlg::OnOk()
  66. {
  67. for( DWORD i = 0; i < Ctxt->nScopes; i ++ )
  68. {
  69. if( m_List.GetItemState( i, LVIS_SELECTED) == LVIS_SELECTED)
  70. {
  71. Ctxt->Scopes[i].fSelected = TRUE;
  72. }
  73. else
  74. {
  75. Ctxt->Scopes[i].fSelected = FALSE;
  76. }
  77. }
  78. if( m_fExport ) {
  79. Ctxt->fDisableExportedScopes = (0 != IsDlgButtonChecked(IDC_CHECK1));
  80. }
  81. CDialog::OnOK();
  82. }
  83. void DhcpEximListDlg::OnCancel()
  84. {
  85. // TODO: Add your control notification handler code here
  86. for( DWORD i = 0; i < Ctxt->nScopes; i ++ )
  87. {
  88. Ctxt->Scopes[i].fSelected = FALSE;
  89. }
  90. CDialog::OnCancel();
  91. }