MCPcopy Create free account
hub / github.com/acl-dev/acl / InitInstance

Function InitInstance

lib_fiber/samples-gui/SimpleWin/SimpleWin.cpp:118–145  ·  view source on GitHub ↗

函数: InitInstance(HINSTANCE, int) 目标: 保存实例句柄并创建主窗口 注释: 在此函数中,我们在全局变量中保存实例句柄并 创建和显示主程序窗口。

Source from the content-addressed store, hash-verified

116// 创建和显示主程序窗口。
117//
118BOOL InitInstance(HINSTANCE hInstance, int nCmdShow)
119{
120 hInst = hInstance; // 将实例句柄存储在全局变量中
121
122 HWND hWnd = CreateWindowW(szWindowClass, szTitle, WS_OVERLAPPEDWINDOW,
123 CW_USEDEFAULT, 0, CW_USEDEFAULT, 0, nullptr, nullptr, hInstance, nullptr);
124
125 if (!hWnd) {
126 return FALSE;
127 }
128
129 ShowWindow(hWnd, nCmdShow);
130 UpdateWindow(hWnd);
131
132 HMENU hMenu = GetMenu(hWnd);
133 EnableMenuItem(hMenu, IDM_STOP_LISTENER, MF_DISABLED);
134 EnableMenuItem(hMenu, IDM_OPEN_DOS, MF_ENABLED);
135 EnableMenuItem(hMenu, IDM_CLOSE_DOS, MF_DISABLED);
136
137 // 设置协程调度的事件引擎,同时将协程调度设为自动启动模式,不能在进程初始化时启动
138 // 协程调试器,必须在界面消息引擎正常运行后才启动协程调度器!
139 acl::fiber::init(acl::FIBER_EVENT_T_WMSG, true);
140 acl::fiber::winapi_hook();
141
142 InitSocket();
143
144 return TRUE;
145}
146
147static bool GetHostByname(const char* name, std::vector<std::string>* addrs)
148{

Callers 5

wWinMainFunction · 0.70
InitInstanceMethod · 0.50
InitInstanceMethod · 0.50
InitInstanceMethod · 0.50
InitInstanceMethod · 0.50

Calls 3

winapi_hookFunction · 0.85
InitSocketFunction · 0.85
initFunction · 0.50

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…