question

rohitpatil-7347 avatar image
0 Votes"
rohitpatil-7347 asked rohitpatil-7347 commented

Unable to cast object of type 'System.Windows.Forms.InternalAccessibleObject' to type 'Accessibility.IAccessible'.

Hello,

I have this line of code in my project,

AutomationElement element = AutomationElement.FromPoint(new System.Windows.Point(Cursor.Position.X, Cursor.Position.Y));

When I move my cursor to select an element then this line of code throws the Exception:

Exception thrown: 'System.InvalidCastException' in UIAutomationClientsideProviders.dll

Additional information: Unable to cast object of type 'System.Windows.Forms.InternalAccessibleObject' to type 'Accessibility.IAccessible'.


windows-10-network
· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Thank You,

But I want to know why it throws the Exception and how I can explicitly cast or avoid this exception.

0 Votes 0 ·

1 Answer

LimitlessTechnology-2700 avatar image
0 Votes"
LimitlessTechnology-2700 answered

Hi @rohitpatil-7347,

Thank you for your question.

There is a topic with a problem similar to yours, I recommend that you check it on the link below:

https://social.msdn.microsoft.com/Forums/vstudio/en-US/82781156-f81b-4b75-892c-c22bad4ad61a/unable-to-cast-object-of-type-systemwindowsformstimer-to-type-systemwindowsformsbutton? forum=charpgeneral



If the answer is helpful, please vote positively and accept as an answer.

5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.