zhipuzi_pos_windows.cpp 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. #include "pch/pch.h"
  2. #include "wnd/CLoginWnd.h"
  3. #include "network/CMessagePush.h"
  4. #include <sqlite3/sqlite3.h>
  5. int APIENTRY wWinMain(_In_ HINSTANCE hInstance,
  6. _In_opt_ HINSTANCE hPrevInstance,
  7. _In_ LPWSTR lpCmdLine,
  8. _In_ int nCmdShow)
  9. {
  10. //初始化日志
  11. CLewaimaiLog log;
  12. log.Init();
  13. //读取配置文件
  14. CConfigReader::ReadConfigFile();
  15. //读取sqlite里面的设置信息
  16. sqlite3 *db;
  17. int rc;
  18. rc = sqlite3_open("db/pos.db", &db);
  19. if(rc)
  20. {
  21. LOG_INFO("Can't open database: " << sqlite3_errmsg(db));
  22. return -1;
  23. }
  24. else
  25. {
  26. LOG_INFO("Opened database successfully");
  27. }
  28. sqlite3_close(db);
  29. //由这个对象来处理消息推送
  30. boost::asio::io_context io_context;
  31. CMessagePush push(io_context);
  32. push.Start();
  33. //开始展示窗口
  34. CPaintManagerUI::SetInstance(hInstance);
  35. #if 0
  36. CPaintManagerUI::SetResourcePath(CPaintManagerUI::GetInstancePath() + _T("skin"));
  37. CPaintManagerUI::SetResourceZip(_T("skin.zip"));
  38. #else
  39. CPaintManagerUI::SetResourcePath(CPaintManagerUI::GetInstancePath() + _T("skin"));
  40. #endif
  41. HRESULT Hr = ::CoInitialize(NULL);
  42. if(FAILED(Hr))
  43. {
  44. return 0;
  45. }
  46. CMainWnd* pFrame = new CMainWnd();
  47. if(pFrame == NULL)
  48. {
  49. return 0;
  50. }
  51. pFrame->SetIcon(IDI_ICON_DUILIB);
  52. pFrame->Create(NULL, _T("游戏中心"), UI_WNDSTYLE_FRAME, 0L, 0, 0, 1024, 738);
  53. pFrame->CenterWindow();
  54. ::ShowWindow(*pFrame, SW_SHOWMAXIMIZED);
  55. /*
  56. CLoginFrameWnd* pLoginFrame = new CLoginFrameWnd();
  57. if (pLoginFrame == NULL) { return 0; }
  58. pLoginFrame->Create(NULL, _T(""), UI_WNDSTYLE_DIALOG, 0, 0, 0, 0, 0, NULL);
  59. pLoginFrame->SetIcon(IDI_ICON_DUILIB);
  60. pLoginFrame->CenterWindow();
  61. pLoginFrame->ShowModal();*/
  62. CPaintManagerUI::MessageLoop();
  63. ::CoUninitialize();
  64. return 0;
  65. }