code_app/sdk/webservice/main.cpp

51 lines
985 B
C++
Raw Normal View History

#include "base/HGDef.h"
#include "base/HGInc.h"
#include "base/HGThread.h"
#include "base/HGUtility.h"
#include "1.0/MsgLoop.h"
#include "2.0/MsgPump.h"
2022-05-03 10:25:52 +00:00
static void ThreadFunc(HGThread thread, HGPointer param)
{
(void)thread;
(void)param;
HGChar cfgPath[256];
HGBase_GetConfigPath(cfgPath, 256);
strcat(cfgPath, "config.ini");
HGInt verNum = 2;
HGBase_GetProfileInt(cfgPath, "version", "verNum", 2, &verNum);
if (1 == verNum) // 使用1.0版本接口
{
MsgLoop loop;
loop.Loop();
}
else // 使用2.0版本接口
{
}
2022-05-03 10:25:52 +00:00
}
#if defined(HG_CMP_MSC)
int WINAPI wWinMain(HINSTANCE hInstance, HINSTANCE iPrevInstance, LPWSTR lpCmdLine, int nCmdShow)
#else
int main()
#endif
{
#if defined(HG_CMP_MSC)
WSADATA ws = { 0 };
int ret = WSAStartup(MAKEWORD(2, 2), &ws);
assert(0 == ret);
#endif
HGThread thread = NULL;
HGBase_OpenThread(ThreadFunc, NULL, &thread);
2022-05-03 10:25:52 +00:00
HGBase_CloseThread(thread);
thread = NULL;
#if defined(HG_CMP_MSC)
WSACleanup();
#endif
return 0;
}