#include "../pch/pch.h" #include "CChufangSettingWnd.h" void CChufangSettingWnd::HandleLogin() { //判断账号密码是否正确 std::wstring account, password; CEditUI* pAccountEdit = static_cast(m_pm.FindControl(_T("accountedit"))); if (pAccountEdit) { account = pAccountEdit->GetText().GetData(); } CEditUI* pPasswordEdit = static_cast(m_pm.FindControl(_T("pwdedit"))); if (pPasswordEdit) { password = pPasswordEdit->GetText().GetData(); } LOG_INFO("account:" << account.c_str() << ", password:" << password.c_str()); string s_account = CLewaimaiString::UnicodeToUTF8(account); string s_password = CLewaimaiString::UnicodeToUTF8(password); CZhipuziHttpClient::Init(s_account, s_password); std::string errmsg; bool res = CZhipuziHttpClient::Login(errmsg); if (res) { CMainWnd* pFrame = new CMainWnd(); if (pFrame == NULL) { return; } pFrame->SetIcon(IDI_ICON_DUILIB); pFrame->Create(NULL, _T("游戏中心"), UI_WNDSTYLE_FRAME, 0L, 0, 0, 1024, 738); pFrame->CenterWindow(); ::ShowWindow(*pFrame, SW_SHOWMAXIMIZED); Close(); } else { //登录失败了 CLabelUI* pLoginResultLabel = static_cast(m_pm.FindControl(_T("loginresult"))); pLoginResultLabel->SetText(std::wstring(_T("登录失败:") + CLewaimaiString::UTF8ToUnicode(errmsg)).c_str()); pLoginResultLabel->SetVisible(true); } }