2022-05-04 03:09:23 +00:00
|
|
|
|
// 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)
|
2023-01-19 07:47:12 +00:00
|
|
|
|
, value_(_T("")), type_(INPUT_FOR_NAME)
|
2022-05-04 03:09:23 +00:00
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
CDlgInput::~CDlgInput()
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void CDlgInput::DoDataExchange(CDataExchange* pDX)
|
|
|
|
|
{
|
|
|
|
|
CDialogEx::DoDataExchange(pDX);
|
|
|
|
|
DDX_Text(pDX, IDC_EDIT1, value_);
|
|
|
|
|
}
|
2023-01-19 07:47:12 +00:00
|
|
|
|
BOOL CDlgInput::OnInitDialog()
|
|
|
|
|
{
|
|
|
|
|
CDialogEx::OnInitDialog();
|
|
|
|
|
|
|
|
|
|
// Set the icon for this dialog. The framework does this automatically
|
|
|
|
|
// when the application's main window is not a dialog
|
|
|
|
|
|
|
|
|
|
return TRUE; // return TRUE unless you set the focus to a control
|
|
|
|
|
}
|
2022-05-04 03:09:23 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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
|
2023-01-19 07:47:12 +00:00
|
|
|
|
UpdateData();
|
|
|
|
|
if (value_.IsEmpty())
|
|
|
|
|
{
|
|
|
|
|
::MessageBoxW(m_hWnd, L"<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>", L"Error", MB_OK | MB_ICONSTOP);
|
|
|
|
|
GotoDlgCtrl(GetDlgItem(IDC_EDIT1));
|
|
|
|
|
return;
|
|
|
|
|
}
|
2022-05-04 03:09:23 +00:00
|
|
|
|
|
2023-01-19 07:47:12 +00:00
|
|
|
|
if (type_ == INPUT_FOR_NAME)
|
2022-05-04 03:09:23 +00:00
|
|
|
|
{
|
2023-01-19 07:47:12 +00:00
|
|
|
|
wchar_t text[128] = { 0 };
|
|
|
|
|
|
|
|
|
|
::GetDlgItemTextW(m_hWnd, IDC_EDIT1, text, _countof(text) - 1);
|
|
|
|
|
for (size_t i = 0; i < used_names_.size(); ++i)
|
2022-05-04 03:09:23 +00:00
|
|
|
|
{
|
2023-01-19 07:47:12 +00:00
|
|
|
|
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;
|
|
|
|
|
}
|
2022-05-04 03:09:23 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
CDialogEx::OnOK();
|
|
|
|
|
}
|