NetIPAria.cpp
上传用户:kklily621
上传日期:2013-06-25
资源大小:252k
文件大小:2k
开发平台:

Visual C++

  1. // NetIPAria.cpp : implementation file
  2. //
  3. #include "stdafx.h"
  4. #include "Property.h"
  5. #include "NetIPAria.h"
  6. //owner add
  7. #include "GuiRes.h"
  8. #ifdef _DEBUG
  9. #define new DEBUG_NEW
  10. #undef THIS_FILE
  11. static char THIS_FILE[] = __FILE__;
  12. #endif
  13. //=============================================================================================
  14. // CNetIPAria dialog
  15. CNetIPAria::CNetIPAria(CWnd* pParent /*=NULL*/)
  16. : CDialog(CNetIPAria::IDD, pParent)
  17. {
  18. iState = 3;
  19. ulStartIP = 0;
  20. ulEndIP = 0;
  21. }
  22. void CNetIPAria::DoDataExchange(CDataExchange* pDX)
  23. {
  24. CDialog::DoDataExchange(pDX);
  25. //{{AFX_DATA_MAP(CNetIPAria)
  26. DDX_Control(pDX, IDC_NET_IP_ARIA_IP_END, m_IPEnd);
  27. DDX_Control(pDX, IDC_NET_IP_ARIA_IP_START, m_IPStart);
  28. //}}AFX_DATA_MAP
  29. }
  30. BEGIN_MESSAGE_MAP(CNetIPAria, CDialog)
  31. //{{AFX_MSG_MAP(CNetIPAria)
  32. //}}AFX_MSG_MAP
  33. END_MESSAGE_MAP()
  34. //=============================================================================================
  35. // CNetIPAria message handlers
  36. BOOL CNetIPAria::OnInitDialog() 
  37. {
  38. CDialog::OnInitDialog();
  39. SetIcon(AfxGetApp()->LoadIcon(IDR_MAINFRAME), TRUE);
  40. InitDlgResource();
  41. return TRUE; 
  42. }
  43. //---------------------------------------------------------------------------------------------
  44. //initialize dialog's resource
  45. void CNetIPAria::InitDlgResource()
  46. {
  47. SetWindowText (GUI_NET_IP_ARIA_CAPTION);
  48. SetDlgItemText(IDC_NET_IP_ARIA_LABLE, GUI_NET_IP_ARIA_LABLE);
  49. SetDlgItemText(IDC_NET_IP_ARIA_LABLE_START_IP, GUI_NET_IP_ARIA_LABLE_START_IP);
  50. SetDlgItemText(IDC_NET_IP_ARIA_LABLE_END_IP, GUI_NET_IP_ARIA_LABLE_END_IP);
  51. SetDlgItemText(IDOK, GUI_BUTTON_OK);
  52. SetDlgItemText(IDCANCEL, GUI_BUTTON_CANCEL_EX);
  53. if(iState == 1)//edit
  54. {
  55. m_IPStart.SetAddress(ulStartIP);
  56. m_IPEnd.SetAddress(ulEndIP);
  57. }
  58. }
  59. void CNetIPAria::OnOK() 
  60. {
  61. DWORD tmpStartIP = 0 , tmpEndIP = 0;
  62. m_IPStart .GetAddress(tmpStartIP);
  63. m_IPEnd .GetAddress(tmpEndIP);
  64. if(tmpStartIP == ulStartIP && tmpEndIP == ulEndIP)
  65. {
  66. CDialog::OnCancel();
  67. return;
  68. }
  69. if(tmpStartIP > tmpEndIP)
  70. {
  71. AfxMessageBox(GUI_NET_IP_ARIA_MESSAGE_INVALID_IP_ARIA);
  72. m_IPStart.SetFocus();
  73. return;
  74. }
  75. ulStartIP = tmpStartIP;
  76. ulEndIP = tmpEndIP;
  77. CDialog::OnOK();
  78. return;
  79. }