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

Function GetSdkBuild

SampleApps/WebView2APISample/AppStartPage.cpp:38–56  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

36}
37
38std::wstring GetSdkBuild()
39{
40 auto options = Microsoft::WRL::Make<CoreWebView2EnvironmentOptions>();
41 wil::unique_cotaskmem_string targetVersion;
42 CHECK_FAILURE(options->get_TargetCompatibleBrowserVersion(&targetVersion));
43
44 // The full version string A.B.C.D
45 const wchar_t* targetVersionMajorAndRest = targetVersion.get();
46 // Should now be .B.C.D
47 const wchar_t* targetVersionMinorAndRest = wcschr(targetVersionMajorAndRest, L'.');
48 CHECK_FAILURE((targetVersionMinorAndRest != nullptr && *targetVersionMinorAndRest == L'.') ? S_OK : E_UNEXPECTED);
49
50 // Should now be .C.D
51 const wchar_t* targetVersionBuildAndRest = wcschr(targetVersionMinorAndRest + 1, L'.');
52 CHECK_FAILURE((targetVersionBuildAndRest != nullptr && *targetVersionBuildAndRest == L'.') ? S_OK : E_UNEXPECTED);
53
54 // Return + 1 to skip the first . so just C.D
55 return targetVersionBuildAndRest + 1;
56}
57
58std::wstring GetRuntimeVersion(AppWindow* appWindow)
59{

Callers 1

GetUriFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected