CLoginWnd.cpp 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. #include "pch/pch.h"
  2. #include "CLoginWnd.h"
  3. void CLoginFrameWnd::HandleLogin()
  4. {
  5. //判断账号密码是否正确
  6. std::wstring account, password;
  7. CEditUI* pAccountEdit = static_cast<CEditUI*>(m_pm.FindControl(_T("accountedit")));
  8. if (pAccountEdit)
  9. {
  10. account = pAccountEdit->GetText().GetData();
  11. }
  12. CEditUI* pPasswordEdit = static_cast<CEditUI*>(m_pm.FindControl(_T("pwdedit")));
  13. if (pPasswordEdit)
  14. {
  15. password = pPasswordEdit->GetText().GetData();
  16. }
  17. LOG_INFO("account:" << account.c_str() << ", password:" << password.c_str());
  18. string s_account = CLewaimaiString::wstring2string(account);
  19. string s_password = CLewaimaiString::wstring2string(password);
  20. CZhipuziHttpClient::Init(s_account, s_password);
  21. bool res = CZhipuziHttpClient::Login();
  22. if (res)
  23. {
  24. CGameFrameWnd* pFrame = new CGameFrameWnd();
  25. if (pFrame == NULL)
  26. {
  27. return;
  28. }
  29. pFrame->SetIcon(IDI_ICON_DUILIB);
  30. pFrame->Create(NULL, _T("游戏中心"), UI_WNDSTYLE_FRAME, 0L, 0, 0, 1024, 738);
  31. pFrame->CenterWindow();
  32. ::ShowWindow(*pFrame, SW_SHOWMAXIMIZED);
  33. Close();
  34. }
  35. }