1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465 |
- // AddContact.cpp : implementation file
- //
- #include "stdafx.h"
- #include "AutoRun.h"
- #include "AddContact.h"
- #ifdef _DEBUG
- #define new DEBUG_NEW
- #undef THIS_FILE
- static char THIS_FILE[] = __FILE__;
- #endif
- /////////////////////////////////////////////////////////////////////////////
- // AddContact dialog
- AddContact::AddContact(CWnd* pParent /*=NULL*/)
- : CDialog(AddContact::IDD, pParent)
- {
- //{{AFX_DATA_INIT(AddContact)
- m_name = _T("");
- m_phone = _T("");
- //}}AFX_DATA_INIT
- }
- void AddContact::DoDataExchange(CDataExchange* pDX)
- {
- CDialog::DoDataExchange(pDX);
- //{{AFX_DATA_MAP(AddContact)
- DDX_Text(pDX, IDC_EDITname, m_name);
- DDX_Text(pDX, IDC_EDITphone, m_phone);
- //}}AFX_DATA_MAP
- }
- BEGIN_MESSAGE_MAP(AddContact, CDialog)
- //{{AFX_MSG_MAP(AddContact)
- //}}AFX_MSG_MAP
- END_MESSAGE_MAP()
- /////////////////////////////////////////////////////////////////////////////
- // AddContact message handlers
- void AddContact::OnOK()
- {
- // TODO: Add extra validation here
- UpdateData();
- m_name.TrimLeft ();
- m_name.TrimRight ();
- m_phone.TrimLeft ();
- m_phone.TrimRight ();
- if(m_name.IsEmpty ())
- {
- AfxMessageBox("联系人姓名不能为空!");
- return;
- }
- if(m_phone.IsEmpty ())
- {
- AfxMessageBox("电话号码不能为空!");
- return;
- }
- CDialog::OnOK();
- }
|