zhipuzi_pay_plugin.cpp 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. #include "pch/pch.h"
  2. #include "wnd/CLoginWnd.h"
  3. #include <curl/curl.h>
  4. int APIENTRY wWinMain(_In_ HINSTANCE hInstance,
  5. _In_opt_ HINSTANCE hPrevInstance,
  6. _In_ LPWSTR lpCmdLine,
  7. _In_ int nCmdShow)
  8. {
  9. //如果进程已经在运行了,直接返回,也就是不支持进程多开
  10. if (CSystem::IsAppRunning())
  11. {
  12. return -1;
  13. }
  14. //初始化日志
  15. CLewaimaiLog log;
  16. log.Init();
  17. //初始化系统设置
  18. CSetting::Init();
  19. //初始化curl
  20. curl_global_init(CURL_GLOBAL_ALL);
  21. //开始展示窗口
  22. CPaintManagerUI::SetInstance(hInstance);
  23. #ifdef NDEBUG
  24. CPaintManagerUI::SetResourcePath(CPaintManagerUI::GetInstancePath() + _T("skin"));
  25. CPaintManagerUI::SetResourceZip(_T("skin.zpz"));
  26. #else
  27. CPaintManagerUI::SetResourcePath(CPaintManagerUI::GetInstancePath() + _T("skin"));
  28. #endif
  29. HRESULT Hr = ::CoInitialize(NULL);
  30. if(FAILED(Hr))
  31. {
  32. return 0;
  33. }
  34. //先显示登录窗口
  35. CLoginWnd* pLogin = new CLoginWnd();
  36. if(pLogin == NULL)
  37. {
  38. return 0;
  39. }
  40. pLogin->Create(NULL, _T("智铺子收银插件登录"), UI_WNDSTYLE_DIALOG, WS_EX_TOOLWINDOW, 0, 0, 0, 0, NULL);
  41. pLogin->SetIcon(IDI_ICON_DUILIB);
  42. pLogin->CenterWindow();
  43. pLogin->ShowModal();
  44. CPaintManagerUI::MessageLoop();
  45. ::CoUninitialize();
  46. return 0;
  47. }