I have some C# code for extracting url from Chrome. It usually works on Win7/Win 8.1, but on some computers with the same configuration it doesn't work. And, probably, there is no difference between these configurations. Why does it happen?
Process[] procsChrome = Process.GetProcessesByName("chrome");
foreach(Process chrome in procsChrome)
{
if(chrome.MainWindowHandle == IntPtr.Zero)
{
continue;
}
AutomationElement mainWindow = AutomationElement.FromHandle(chrome.MainWindowHandle);
elmUrlBar = mainWindow.FindFirst(TreeScope.Descendants, new PropertyCondition(AutomationElement.ControlTypeProperty, ControlType.Edit));
//elmUrlBar on some computers inited, on some NULL. But versions of Chrome are identical.
...
}