CWebView::IsInitialized Method  
 
BOOL IsInitialized();

The IsInitialized method returns whether or not the class object has been successfully initialized.

Return Value

This method returns a non-zero value if the class object has been successfully initialized. A return value of zero indicates that the runtime license key could not be validated or the networking library could not be loaded by the current process.

Remarks

When an instance of the class is created, the class constructor will attempt to initialize the component with the runtime license key that was created when SocketTools was installed. If the constructor is unable to validate the license key or load the networking libraries, this initialization will fail.

If SocketTools was installed with an evaluation license, the application cannot be redistributed to another system. The class object will fail to initialize if the application is executed on another system, or if the evaluation period has expired. To redistribute your application, you must purchase a development license which will include the runtime key that is needed to redistribute your software to other systems. Refer to the Developer's Guide for more information.

When the class is initialized, it will also attempt to load the WebView2 runtime. The calling thread must be in a single-threaded apartment (STA). During initialization the class calls CoInitializeEx as needed and if your process has already initialized COM as MTA (COINIT_MULTITHREADED), initialization will fail. This requirement comes directly from the Edge WebView2 control which cannot be created in an MTA COM application.

The RuntimeAvailable method can be used to determine if the Microsoft Edge WebView2 runtime is installed and meets the minimum required version. This can be useful during application startup to provide a clear error message or guidance to the user if the runtime is missing or out of date, rather than attempting to initialize the control and handling the failure afterward. This is a static method which can be called without creating an instance of the CWebView class.

On modern versions of Windows, the WebView2 runtime is included as part of the operating system and is serviced through Windows Update. However, on older or unsupported versions of Windows the runtime may not be present by default and must be installed separately. In these cases, your application needs to detect the missing runtime and prompt the user to install it.

Requirements

Minimum Desktop Platform: Windows 7 Service Pack 1
Minimum Server Platform: Windows Server 2008 R2 Service Pack 1
Header File: cstools12.h
Import Library: cshtpv12.lib

See Also