// PswdDlg.cpp : implementation file // #include "stdafx.h" #include "singleport.h" #include "PswdDlg.h" #ifdef _DEBUG #define new DEBUG_NEW #undef THIS_FILE static char THIS_FILE[] = __FILE__; #endif extern CSinglePortApp theApp; ///////////////////////////////////////////////////////////////////////////// // CPswdDlg dialog CPswdDlg::CPswdDlg(CWnd* pParent /*=NULL*/) : CDialog(CPswdDlg::IDD, pParent) { //{{AFX_DATA_INIT(CPswdDlg) m_ServerPswd = _T(""); //}}AFX_DATA_INIT } void CPswdDlg::DoDataExchange(CDataExchange* pDX) { CDialog::DoDataExchange(pDX); //{{AFX_DATA_MAP(CPswdDlg) DDX_Text(pDX, IDC_EDIT_SERVERPSW, m_ServerPswd); //}}AFX_DATA_MAP } BEGIN_MESSAGE_MAP(CPswdDlg, CDialog) //{{AFX_MSG_MAP(CPswdDlg) ON_WM_DESTROY() ON_BN_CLICKED(IDC_BTN_OK, OnBtnOk) //}}AFX_MSG_MAP END_MESSAGE_MAP() ///////////////////////////////////////////////////////////////////////////// // CPswdDlg message handlers UINT CPswdDlg::OnBtnOk() { // TODO: Add your control notification handler code here UpdateData(TRUE); if(m_ServerPswd == _T("")) // Handle Password NULL condition { GetDlgItem( IDC_EDIT_SERVERPSW )->SetFocus(); AfxMessageBox(_T("Please Enter a Valid Password")); return FALSE; } CSinglePortDlg* pDlg = theApp.GetDlgPtr(); sprintf(pDlg->m_szServerPswd, m_ServerPswd); EndDialog( IDOK ); return IDOK; // return IDOK to specify password not NULL ,so further progress could be progressed }