MCPcopy Create free account
hub / github.com/MicrosoftEdge/WebView2Samples / wWinMain

Function wWinMain

SampleApps/WebView2APISample/App.cpp:31–135  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

29 _wcsnicmp(nextParam.c_str(), command, ARRAYSIZE(command) - 1) == 0
30
31int APIENTRY
32wWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, PWSTR lpCmdLine, int nCmdShow)
33{
34 g_hInstance = hInstance;
35 UNREFERENCED_PARAMETER(hPrevInstance);
36 g_nCmdShow = nCmdShow;
37
38 // Default DPI awareness to PerMonitorV2. The commandline parameters can
39 // override this.
40 DPI_AWARENESS_CONTEXT dpiAwarenessContext = DPI_AWARENESS_CONTEXT_PER_MONITOR_AWARE_V2;
41 std::wstring appId(L"EBWebView.SampleApp");
42 std::wstring userDataFolder(L"");
43 std::wstring initialUri;
44 DWORD creationModeId = IDM_CREATION_MODE_WINDOWED;
45 WebViewCreateOption opt;
46
47 if (lpCmdLine && lpCmdLine[0])
48 {
49 int paramCount = 0;
50 LPWSTR* params = CommandLineToArgvW(GetCommandLineW(), &paramCount);
51 for (int i = 0; i < paramCount; ++i)
52 {
53 std::wstring nextParam;
54 if (params[i][0] == L'-')
55 {
56 if (params[i][1] == L'-')
57 {
58 nextParam.assign(params[i] + 2);
59 }
60 else
61 {
62 nextParam.assign(params[i] + 1);
63 }
64 }
65 if (NEXT_PARAM_CONTAINS(L"dpiunaware"))
66 {
67 dpiAwarenessContext = DPI_AWARENESS_CONTEXT_UNAWARE;
68 }
69 else if (NEXT_PARAM_CONTAINS(L"dpisystemaware"))
70 {
71 dpiAwarenessContext = DPI_AWARENESS_CONTEXT_SYSTEM_AWARE;
72 }
73 else if (NEXT_PARAM_CONTAINS(L"dpipermonitorawarev2"))
74 {
75 dpiAwarenessContext = DPI_AWARENESS_CONTEXT_PER_MONITOR_AWARE_V2;
76 }
77 else if (NEXT_PARAM_CONTAINS(L"dpipermonitoraware"))
78 {
79 dpiAwarenessContext = DPI_AWARENESS_CONTEXT_PER_MONITOR_AWARE;
80 }
81 else if (NEXT_PARAM_CONTAINS(L"noinitialnavigation"))
82 {
83 initialUri = L"none";
84 }
85 else if (NEXT_PARAM_CONTAINS(L"appid="))
86 {
87 appId = nextParam.substr(nextParam.find(L'=') + 1);
88 }

Callers

nothing calls this directly

Calls 2

WaitForOtherThreadsFunction · 0.85
RunMessagePumpFunction · 0.70

Tested by

no test coverage detected