SearchUserDlg.cpp
上传用户:maryhy001
上传日期:2007-05-02
资源大小:2317k
文件大小:3k
源码类别:

网格计算

开发平台:

Visual C++

  1. // SearchUserDlg.cpp : implementation file
  2. //
  3. #include "stdafx.h"
  4. #include "trfAgent.h"
  5. #include "SearchUserDlg.h"
  6. /////////////////////////////////////////////////////////////////////////////
  7. CSearchUserDlg::CSearchUserDlg(CWnd* pParent /*=NULL*/)
  8. : CDialog(CSearchUserDlg::IDD, pParent)
  9. {
  10. //{{AFX_DATA_INIT(CSearchUserDlg)
  11. m_shostname = _T("");
  12. m_susername = _T("");
  13. //}}AFX_DATA_INIT
  14. }
  15. void CSearchUserDlg::DoDataExchange(CDataExchange* pDX)
  16. {
  17. CDialog::DoDataExchange(pDX);
  18. //{{AFX_DATA_MAP(CSearchUserDlg)
  19. DDX_Control(pDX, IDC_IPADDR, m_sipaddr);
  20. DDX_Text(pDX, IDC_EDTHOSTNAME, m_shostname);
  21. DDV_MaxChars(pDX, m_shostname, 64);
  22. DDX_Text(pDX, IDC_EDTUSERNAME, m_susername);
  23. DDV_MaxChars(pDX, m_susername, 32);
  24. //}}AFX_DATA_MAP
  25. }
  26. BEGIN_MESSAGE_MAP(CSearchUserDlg, CDialog)
  27. //{{AFX_MSG_MAP(CSearchUserDlg)
  28. ON_BN_CLICKED(IDC_RDSEARCH_HOST, OnRdsearchHost)
  29. ON_BN_CLICKED(IDC_RDSEARCH_IP, OnRdsearchIp)
  30. ON_BN_CLICKED(IDC_RDSEARCH_NAME, OnRdsearchName)
  31. //}}AFX_MSG_MAP
  32. END_MESSAGE_MAP()
  33. /////////////////////////////////////////////////////////////////////////////
  34. // CSearchUserDlg message handlers
  35. BOOL CSearchUserDlg::OnInitDialog() 
  36. {
  37. CDialog::OnInitDialog();
  38. CButton *pwndRadio = static_cast<CButton*>(this->GetDlgItem(IDC_RDSEARCH_NAME));
  39. pwndRadio->SetCheck(1);
  40. CWnd *pwnd = this->GetDlgItem(IDC_EDTUSERNAME);
  41. pwnd->EnableWindow(TRUE);
  42. pwnd = this->GetDlgItem(IDC_EDTHOSTNAME);
  43. pwnd->EnableWindow(FALSE);
  44. pwnd = this->GetDlgItem(IDC_IPADDR);
  45. pwnd->EnableWindow(FALSE);
  46. m_chkusrname = true;
  47. m_chkhostname = false;
  48. m_chkipaddr = false;
  49. m_sipaddrtxt.Empty();
  50. return TRUE;
  51. }
  52. void CSearchUserDlg::OnRdsearchHost() 
  53. {
  54. m_chkusrname = false;
  55. m_chkhostname = true;
  56. m_chkipaddr = false;
  57. CWnd *pwnd = NULL;
  58. pwnd = this->GetDlgItem(IDC_EDTUSERNAME);
  59. pwnd->EnableWindow(FALSE);
  60. pwnd = this->GetDlgItem(IDC_EDTHOSTNAME);
  61. pwnd->EnableWindow(TRUE);
  62. pwnd = this->GetDlgItem(IDC_IPADDR);
  63. pwnd->EnableWindow(FALSE);
  64. }
  65. void CSearchUserDlg::OnRdsearchIp() 
  66. {
  67. m_chkusrname = false;
  68. m_chkhostname = false;
  69. m_chkipaddr = true;
  70. CWnd *pwnd = NULL;
  71. pwnd = this->GetDlgItem(IDC_EDTUSERNAME);
  72. pwnd->EnableWindow(FALSE);
  73. pwnd = this->GetDlgItem(IDC_EDTHOSTNAME);
  74. pwnd->EnableWindow(FALSE);
  75. pwnd = this->GetDlgItem(IDC_IPADDR);
  76. pwnd->EnableWindow(TRUE);
  77. }
  78. void CSearchUserDlg::OnRdsearchName() 
  79. {
  80. m_chkusrname = true;
  81. m_chkhostname = false;
  82. m_chkipaddr = false;
  83. CWnd *pwnd = NULL;
  84. pwnd = this->GetDlgItem(IDC_EDTUSERNAME);
  85. pwnd->EnableWindow(TRUE);
  86. pwnd = this->GetDlgItem(IDC_EDTHOSTNAME);
  87. pwnd->EnableWindow(FALSE);
  88. pwnd = this->GetDlgItem(IDC_IPADDR);
  89. pwnd->EnableWindow(FALSE);
  90. }
  91. void CSearchUserDlg::OnOK() 
  92. {
  93. BYTE bfld[4];
  94. m_sipaddr.GetAddress(bfld[0], bfld[1], bfld[2], bfld[3]);
  95. m_sipaddrtxt.Format("%d.%d.%d.%d", bfld[0], bfld[1], bfld[2], bfld[3]);
  96. CDialog::OnOK();
  97. }