![]() |
#2
李昊逸Lion2018-03-14 18:23
|

void Make::OnBnClickedOk()
{
UpdateData(true);
if (Again == NewPassword) {
USES_CONVERSION;
string name = W2A(NewName.LockBuffer());
NewName.UnlockBuffer();
char buf[100],buf2[100];
sprintf_s(buf2, "D:\\Valiant_game\\%s", name.c_str());
CString strFolderPath;
strFolderPath.Format(_T("%s"), "D:\\Valiant_game");
// 判断路径是否存在
if (!PathIsDirectory(strFolderPath))
{
CreateDirectory(strFolderPath, NULL);
}
strFolderPath.Format(_T("%s"), buf2);
if (!PathIsDirectory(strFolderPath))
{
CreateDirectory(strFolderPath, NULL);
}
else
{
MessageBox(_T("此用户已注册"), _T("错误"), MB_OK);
}
sprintf_s(buf, "D:\\Valiant_game\\%s\\Password", name.c_str());
ofstream fout(buf);
fout << NewPassword;
}
else
{
MessageBox(_T("确认密码错误"), _T("错误"), MB_OK);
}
// TODO: 在此添加控件通知处理程序代码
CDialogEx::OnOK();
}
{
UpdateData(true);
if (Again == NewPassword) {
USES_CONVERSION;
string name = W2A(NewName.LockBuffer());
NewName.UnlockBuffer();
char buf[100],buf2[100];
sprintf_s(buf2, "D:\\Valiant_game\\%s", name.c_str());
CString strFolderPath;
strFolderPath.Format(_T("%s"), "D:\\Valiant_game");
// 判断路径是否存在
if (!PathIsDirectory(strFolderPath))
{
CreateDirectory(strFolderPath, NULL);
}
strFolderPath.Format(_T("%s"), buf2);
if (!PathIsDirectory(strFolderPath))
{
CreateDirectory(strFolderPath, NULL);
}
else
{
MessageBox(_T("此用户已注册"), _T("错误"), MB_OK);
}
sprintf_s(buf, "D:\\Valiant_game\\%s\\Password", name.c_str());
ofstream fout(buf);
fout << NewPassword;
}
else
{
MessageBox(_T("确认密码错误"), _T("错误"), MB_OK);
}
// TODO: 在此添加控件通知处理程序代码
CDialogEx::OnOK();
}