| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106 |
- #include "pch/pch.h"
- #include "wnd/CLoginWnd.h"
- #include <curl/curl.h>
- #include "tool/CAppEnv.h"
- #include "../ai/test.h"
- #include <opencv2/opencv.hpp>
- #include <opencv2/dnn.hpp>
- //用于从zip读取资源
- LPBYTE g_lpResourceZIPBuffer = NULL;
- int APIENTRY wWinMain(_In_ HINSTANCE hInstance,
- _In_opt_ HINSTANCE hPrevInstance,
- _In_ LPWSTR lpCmdLine,
- _In_ int nCmdShow)
- {
- //如果进程已经在运行了,直接返回,也就是不支持进程多开
- if (CSystem::IsAppRunning())
- {
- return -1;
- }
- //初始化日志,这个一定要放在这里,才不会被析构掉
- CLewaimaiLog log;
- log.Init();
- //初始化所有配置,启动所有异步worker
- CAppEnv app;
- app.Start();
- //AITest();
- //开始展示窗口
- CPaintManagerUI::SetInstance(hInstance);
- #ifdef NDEBUG
- //CPaintManagerUI::SetResourcePath(CPaintManagerUI::GetInstancePath() + _T("skin"));
- //CPaintManagerUI::SetResourceZip(_T("skin.zpz"));
- //从资源中加载zip
- HRSRC hResource = ::FindResource(CPaintManagerUI::GetResourceDll(), MAKEINTRESOURCE(IDR_ZIPRES1), _T("ZIPRES"));
- if (hResource == NULL)
- {
- return 0L;
- }
- DWORD dwSize = 0;
- HGLOBAL hGlobal = ::LoadResource(CPaintManagerUI::GetResourceDll(), hResource);
- if (hGlobal == NULL)
- {
- ::FreeResource(hResource);
- return 0L;
- }
- dwSize = ::SizeofResource(CPaintManagerUI::GetResourceDll(), hResource);
- if (dwSize == 0)
- {
- return 0L;
- }
- g_lpResourceZIPBuffer = new BYTE[dwSize];
- if (g_lpResourceZIPBuffer != NULL)
- {
- ::CopyMemory(g_lpResourceZIPBuffer, (LPBYTE)::LockResource(hGlobal), dwSize);
- }
- ::FreeResource(hResource);
- CPaintManagerUI::SetResourceZip(g_lpResourceZIPBuffer, dwSize);
- #else
- //debug模式下
- CPaintManagerUI::SetResourcePath(CPaintManagerUI::GetInstancePath() + _T("skin"));
- #endif
- HRESULT Hr = ::CoInitialize(NULL);
- if(FAILED(Hr))
- {
- return 0;
- }
- //先显示登录窗口
- CLoginWnd* pLogin = new CLoginWnd();
- if(pLogin == NULL)
- {
- return 0;
- }
- pLogin->Create(NULL, _T("智铺子收银软件登录"), UI_WNDSTYLE_DIALOG, 0, 0, 0, 0, 0, NULL);
- pLogin->SetIcon(IDI_ICON_DUILIB);
- pLogin->CenterWindow();
- pLogin->ShowWindow(true);
- CPaintManagerUI::MessageLoop();
- ::CoUninitialize();
- //销毁一些环境
- app.Stop();
- return 0;
- }
|