SearchUserDlg.cpp
上传用户:maryhy001
上传日期:2007-05-02
资源大小:2317k
文件大小:3k
- // SearchUserDlg.cpp : implementation file
- //
- #include "stdafx.h"
- #include "trfAgent.h"
- #include "SearchUserDlg.h"
- /////////////////////////////////////////////////////////////////////////////
- CSearchUserDlg::CSearchUserDlg(CWnd* pParent /*=NULL*/)
- : CDialog(CSearchUserDlg::IDD, pParent)
- {
- //{{AFX_DATA_INIT(CSearchUserDlg)
- m_shostname = _T("");
- m_susername = _T("");
- //}}AFX_DATA_INIT
- }
- void CSearchUserDlg::DoDataExchange(CDataExchange* pDX)
- {
- CDialog::DoDataExchange(pDX);
- //{{AFX_DATA_MAP(CSearchUserDlg)
- DDX_Control(pDX, IDC_IPADDR, m_sipaddr);
- DDX_Text(pDX, IDC_EDTHOSTNAME, m_shostname);
- DDV_MaxChars(pDX, m_shostname, 64);
- DDX_Text(pDX, IDC_EDTUSERNAME, m_susername);
- DDV_MaxChars(pDX, m_susername, 32);
- //}}AFX_DATA_MAP
- }
- BEGIN_MESSAGE_MAP(CSearchUserDlg, CDialog)
- //{{AFX_MSG_MAP(CSearchUserDlg)
- ON_BN_CLICKED(IDC_RDSEARCH_HOST, OnRdsearchHost)
- ON_BN_CLICKED(IDC_RDSEARCH_IP, OnRdsearchIp)
- ON_BN_CLICKED(IDC_RDSEARCH_NAME, OnRdsearchName)
- //}}AFX_MSG_MAP
- END_MESSAGE_MAP()
- /////////////////////////////////////////////////////////////////////////////
- // CSearchUserDlg message handlers
- BOOL CSearchUserDlg::OnInitDialog()
- {
- CDialog::OnInitDialog();
-
- CButton *pwndRadio = static_cast<CButton*>(this->GetDlgItem(IDC_RDSEARCH_NAME));
- pwndRadio->SetCheck(1);
- CWnd *pwnd = this->GetDlgItem(IDC_EDTUSERNAME);
- pwnd->EnableWindow(TRUE);
- pwnd = this->GetDlgItem(IDC_EDTHOSTNAME);
- pwnd->EnableWindow(FALSE);
- pwnd = this->GetDlgItem(IDC_IPADDR);
- pwnd->EnableWindow(FALSE);
- m_chkusrname = true;
- m_chkhostname = false;
- m_chkipaddr = false;
- m_sipaddrtxt.Empty();
- return TRUE;
- }
- void CSearchUserDlg::OnRdsearchHost()
- {
- m_chkusrname = false;
- m_chkhostname = true;
- m_chkipaddr = false;
- CWnd *pwnd = NULL;
- pwnd = this->GetDlgItem(IDC_EDTUSERNAME);
- pwnd->EnableWindow(FALSE);
-
- pwnd = this->GetDlgItem(IDC_EDTHOSTNAME);
- pwnd->EnableWindow(TRUE);
-
- pwnd = this->GetDlgItem(IDC_IPADDR);
- pwnd->EnableWindow(FALSE);
- }
- void CSearchUserDlg::OnRdsearchIp()
- {
- m_chkusrname = false;
- m_chkhostname = false;
- m_chkipaddr = true;
-
- CWnd *pwnd = NULL;
-
- pwnd = this->GetDlgItem(IDC_EDTUSERNAME);
- pwnd->EnableWindow(FALSE);
-
- pwnd = this->GetDlgItem(IDC_EDTHOSTNAME);
- pwnd->EnableWindow(FALSE);
-
- pwnd = this->GetDlgItem(IDC_IPADDR);
- pwnd->EnableWindow(TRUE);
-
- }
- void CSearchUserDlg::OnRdsearchName()
- {
- m_chkusrname = true;
- m_chkhostname = false;
- m_chkipaddr = false;
-
- CWnd *pwnd = NULL;
- pwnd = this->GetDlgItem(IDC_EDTUSERNAME);
- pwnd->EnableWindow(TRUE);
-
- pwnd = this->GetDlgItem(IDC_EDTHOSTNAME);
- pwnd->EnableWindow(FALSE);
-
- pwnd = this->GetDlgItem(IDC_IPADDR);
- pwnd->EnableWindow(FALSE);
- }
- void CSearchUserDlg::OnOK()
- {
- BYTE bfld[4];
-
- m_sipaddr.GetAddress(bfld[0], bfld[1], bfld[2], bfld[3]);
- m_sipaddrtxt.Format("%d.%d.%d.%d", bfld[0], bfld[1], bfld[2], bfld[3]);
- CDialog::OnOK();
- }