MCPcopy Create free account
hub / github.com/M2Team/NanaGet / wWinMain

Function wWinMain

NanaGet/WinMain.cpp:393–442  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

391}
392
393int WINAPI wWinMain(
394 _In_ HINSTANCE hInstance,
395 _In_opt_ HINSTANCE hPrevInstance,
396 _In_ LPWSTR lpCmdLine,
397 _In_ int nShowCmd)
398{
399 UNREFERENCED_PARAMETER(hPrevInstance);
400 UNREFERENCED_PARAMETER(lpCmdLine);
401
402 winrt::init_apartment(winrt::apartment_type::single_threaded);
403
404 winrt::com_ptr<winrt::NanaGet::implementation::App> app =
405 winrt::make_self<winrt::NanaGet::implementation::App>();
406
407 g_Module.Init(nullptr, hInstance);
408
409 NanaGet::LocalAria2Instance LocalInstance;
410 NanaGet::LocalInstance = &LocalInstance;
411
412 winrt::NanaGet::MainPage Control =
413 winrt::make<winrt::NanaGet::implementation::MainPage>();
414
415 NanaGet::MainWindow Window;
416 if (!Window.Create(
417 nullptr,
418 Window.rcDefault,
419 L"NanaGet",
420 WS_OVERLAPPED | WS_CAPTION | WS_SYSMENU | WS_MINIMIZEBOX,
421 WS_EX_CLIENTEDGE,
422 nullptr,
423 winrt::get_abi(Control)))
424 {
425 return -1;
426 }
427 NanaGet::MainWindowHandle = Window.m_hWnd;
428 Window.ShowWindow(nShowCmd);
429 Window.UpdateWindow();
430
431 WTL::CMessageLoop MessageLoop;
432 MessageLoop.AddMessageFilter(&Window);
433 g_Module.AddMessageLoop(&MessageLoop);
434 int Result = MessageLoop.Run();
435
436 g_Module.RemoveMessageLoop();
437 g_Module.Term();
438
439 app->Close();
440
441 return Result;
442}

Callers

nothing calls this directly

Calls 1

CloseMethod · 0.80

Tested by

no test coverage detected