// DlgInput.cpp : implementation file // #include "stdafx.h" #include "hgjson.h" #include "DlgInput.h" #include "afxdialogex.h" // CDlgInput dialog IMPLEMENT_DYNAMIC(CDlgInput, CDialogEx) CDlgInput::CDlgInput(CWnd* pParent /*=NULL*/) : CDialogEx(CDlgInput::IDD, pParent) , value_(_T("")) { } CDlgInput::~CDlgInput() { } void CDlgInput::DoDataExchange(CDataExchange* pDX) { CDialogEx::DoDataExchange(pDX); DDX_Text(pDX, IDC_EDIT1, value_); } BEGIN_MESSAGE_MAP(CDlgInput, CDialogEx) ON_BN_CLICKED(IDOK, &CDlgInput::OnBnClickedOk) END_MESSAGE_MAP() // CDlgInput message handlers void CDlgInput::OnBnClickedOk() { // TODO: Add your control notification handler code here wchar_t text[128] = { 0 }; ::GetDlgItemTextW(m_hWnd, IDC_EDIT1, text, _countof(text) - 1); for (size_t i = 0; i < used_names_.size(); ++i) { if (used_names_[i] == text) { std::wstring t(used_names_[i] + L" is already used, choose another name, plz."); ::MessageBoxW(m_hWnd, t.c_str(), L"Sorry", MB_OK); return; } } CDialogEx::OnOK(); }