0

I need to cast ControlType object that belongs to the struct AutomationElementInformation from Interop.UIAutomationClient.dll to UIAComWrapper.dll. Both belongs to namespace System.Windows.Automation.

I tried JSON serialization/de-serialization but that requires constructor, whereas class ControlType has static, read-only members.

  • Don't mix both assemblies usage in a given project. You should only need/use one of them. – Simon Mourier Jan 10 '22 at 08:47
  • I don't want to, I need to, due to the tradeoff among performance and data. You will get more context here : https://stackoverflow.com/questions/70590834/windows-automation-detect-control-having-keyboard-focus/70649606#70649606 – Prateek Gupta Jan 10 '22 at 10:51
  • This is all wrong. UIAutomationClient and associated dlls are .NET 15 years old legacy wrappers that Microsoft never updated. UIAComWrapper is an open source attempt by a Microsoft guy to update that legacy wrappers which is also now deprecated since he never updated it. If you want to use UI automation with .NET from Visual Studio just add a COM reference to UIAutomationClient (which will create an Interop.UIAutomationClient.dll) and off you go. Note your calling source code won't be 100% identical but you'll have one DLL and benefit from all possible recent additions, property ids, etc. – Simon Mourier Jan 10 '22 at 10:59
  • I also noticed that the UIAComWrapper project has been deprecated. Based on the link above, I tried to use mix of both to gain performance. I also thought of using Interop.UIAutomationClient.dll only as it is updated and being maintained. So you are saying it won't affect performance? (Because the current codebase uses UIAComWrapper heavily) – Prateek Gupta Jan 10 '22 at 14:16
  • I don' have specific performance issue so I don't know what you're talking about but UI automation is implemented by this native COM object anyway, whatever .NET wrapper you use. – Simon Mourier Jan 10 '22 at 15:19
  • By performance, I am taking about this: https://stackoverflow.com/a/46523396/14200631 – Prateek Gupta Jan 11 '22 at 18:39
  • There's no performance issue described in this post – Simon Mourier Jan 11 '22 at 18:51

0 Answers0