The native WebView2 SDK provides the options interface and a ready-made implementation. If CoreWebView2EnvironmentOptions appears to be missing, include WebView2EnvironmentOptions.h as well as the headers used by the existing host.

#include <wrl.h>
#include <WebView2.h>
#include <WebView2EnvironmentOptions.h>

auto options =
    Microsoft::WRL::Make<CoreWebView2EnvironmentOptions>();

HRESULT hr = options->put_AdditionalBrowserArguments(
    L"--proxy-server=http://proxy.example.net:8080");

After handling a failed HRESULT through the application’s normal error path, supply that object as the third argument to environment creation:

hr = CreateCoreWebView2EnvironmentWithOptions(
    nullptr, userDataFolder, options.Get(), completionHandler.Get());

Here userDataFolder and completionHandler are the host’s existing folder argument and environment-completion handler. Continue creating the controller from the environment delivered to that handler. For permitted public-site requests, an endpoint from the HTTP proxy list can fill the HTTP proxy launch argument.

put_AdditionalBrowserArguments replaces the previous argument string. When the host also needs other browser flags, construct one space-separated string containing all of them before creating the environment.

Artihkkalat mat laktásit