I have a WinForm app which has just a WebView2 which shows a local website.
That application is launched from another application and once it's running the user will scan some stuff, the issue is that once my application runs the WebView2 doesn't have the focus so when the user scans the items they are not processed by my webpage.
Only once i click at the control i'm able to do my stuff.
How can i set the focus to my WebView once the application is launched?
I have tried the following in Form load:
private void Form1_Load(object sender, EventArgs e)
{
webView.Source = new Uri(System.IO.Path.GetDirectoryName(Application.ExecutablePath) + "\\XXXX\\index.html");
TopMost = true;
Focus();
BringToFront();
Activate();
webView.Focus();
}