The FindBrowser method can be used to locate the
window handle for an existing WebView2 instance that was created by
the calling process. This is useful if the application needs to
re-establish a reference to a previously created browser window, for
example when handling messages or coordinating multiple windows.
If a parent window handle is specified, the method will restrict
its search to that window and its children. This is the most efficient
approach when the caller already knows the expected parent container.
If the parameter is NULL, all top-level windows owned by the process
are searched. An optional URL string can also be provided to limit
results to windows whose current location contains the specified
substring. The search is case-insensitive and only applies to windows
created by the current process.
The method only returns a single matching window handle. If
multiple instances could match the criteria, the particular instance
returned is not guaranteed and the caller should design accordingly.
When both the parent handle and search string are NULL, the method
simply locates the first available WebView2 instance owned by the
current thread.
If the optional lpdwThreadId parameter is supplied, it will
receive the thread identifier that owns the WebView2 instance. This
can be used when thread affinity is important, such as posting
messages directly to the UI thread.