Help Center

CompareBrowserVersionsfunction

Get the browser version info including channel name if it is not the WebView2 Runtime.

WebViewfunctiondocumented

Syntax

FUNCTION CompareBrowserVersions (BYVAL version1 AS PCWSTR, BYVAL version2 AS PCWSTR, BYVAL result AS INT_ PTR) AS HRESULT

Parameters

NameDescription
version1[in] One of the version strings to compare.
version2[in] The other version string to compare.
result[out] Pointer to an INT variable that receives the result.

Description

Compares two instances of browser versions correctly and returns an integer that indicates whether the first instance is older, the same as, or newer than the second instance.

It can be used to determine whether to use webview2 or certain feature base on version. Sets the value of result to -1, 0 or 1 if version1 is less than, equal or greater than version2 respectively. Returns E_INVALIDARG if it fails to parse any of the version strings or any input parameter is null. Input can directly use the versionInfo obtained from GetAvailableCoreWebView2BrowserVersionString, channel info will be ignored.

Reference

  • Defined in AfxNova/AfxWebView2.bi:1114
  • Documented in WebView/CWebWiew2 Class.md
  • Topic: CWebView2 Class