CLoginWnd.cpp 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  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. rapidjson::Document doc;
  19. doc.SetObject();
  20. rapidjson::Document::AllocatorType &allocator = doc.GetAllocator(); //获取分配器
  21. string s_account = CLewaimaiString::wstring2string(account);
  22. doc.AddMember(rapidjson::StringRef("useranme"), rapidjson::StringRef(s_account.c_str()), allocator);
  23. string s_password = CLewaimaiString::wstring2string(password);
  24. doc.AddMember(rapidjson::StringRef("password"), rapidjson::StringRef(s_password.c_str()), allocator);
  25. rapidjson::StringBuffer buffer;
  26. rapidjson::Writer<rapidjson::StringBuffer> writer(buffer);
  27. doc.Accept(writer);
  28. std::string json = std::string(buffer.GetString());
  29. LOG_INFO("json:" << json.c_str());
  30. CGameFrameWnd* pFrame = new CGameFrameWnd();
  31. if (pFrame == NULL)
  32. {
  33. return;
  34. }
  35. pFrame->SetIcon(IDI_ICON_DUILIB);
  36. pFrame->Create(NULL, _T("游戏中心"), UI_WNDSTYLE_FRAME, 0L, 0, 0, 1024, 738);
  37. pFrame->CenterWindow();
  38. ::ShowWindow(*pFrame, SW_SHOWMAXIMIZED);
  39. Close();
  40. }