So I'm trying to get the Window handle for a Microsoft edge instance that I'm spawning.
Seem to be able to find pretty much everything but the Edge instance and I'm wondering if Windows Apps behave differently when using this approach.
For example I visit Google.com with the Edge instance I've created so the title of the window is "Google" but when I inspect MainWindowTitle its never "Google" or anything related to the Edge instance.
What am I doing wrong here and if this method is flawed what are my options for getting a handle for the instance I've spawned?
I've tried doing it by process ID but it spawns off other processes that you can't seem to get by the parent process ID.
p.StartInfo.FileName = @"explorer.exe";
p.StartInfo.Arguments = @" shell:Appsfolder\Microsoft.MicrosoftEdge_8wekyb3d8bbwe!MicrosoftEdge";
started = p.Start();
foreach (Process pList in Process.GetProcesses())
{
if(pList.MainWindowTitle.Length>0)
{
if (pList.MainWindowTitle.Contains("Google"))
{
hWnd = pList.MainWindowHandle;
}
}
}