you need to get the URL from the current tab in firefox without using DDE in C #, DDE doesn’t work, the error is "The client failed to request" plan | I realized that there is another such client, but I did not find the information about how to "reconcile" it. I also use
static string GetBrowsedUrl(Process process) { if (process.ProcessName == "firefox") { if (process == null) return null; if (process.MainWindowHandle == IntPtr.Zero) return null; AutomationElement element = AutomationElement.FromHandle(process.MainWindowHandle); if (element == null) return null; var doc = element.FindFirst(TreeScope.Subtree, new PropertyCondition(AutomationElement.ControlTypeProperty, ControlType.Document)); if (doc == null) return null; string _url_ = null; _url_ = ((ValuePattern)doc.GetCurrentPattern(ValuePattern.Pattern)).Current.Value as string; return _url_; } return null; } but it only returns the first tab, I did so
var doc = element.FindAll(TreeScope.Subtree, new PropertyCondition(AutomationElement.ControlTypeProperty, ControlType.Document)); if (doc == null) return null; string _url_=null; for (int i=0;i<doc.Count;i++) _url_=((ValuePattern) doc[i].GetCurrentPattern(ValuePattern.Pattern)).Current.Value as string; return _url_; I get all the tabs and then I can get the one I need, but it takes 5 if not 7 seconds !!!! I need to quickly, can someone tell me how to hook you can, or explain to the unfortunate progra with DDE how to "be friends" ...