Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Convert IRawElementProviderSimple to Cswin32 #10177

Merged
merged 19 commits into from
Nov 3, 2023

Conversation

lonitra
Copy link
Member

@lonitra lonitra commented Oct 23, 2023

Related: #9795

This change converts IRawElementProviderSimple to use Cswin32 definition. This interface includes definition of GetPropertyValue, which now returns VARIANT instead of object, so the bulk of this change involves casting what was returned from GetPropertyValue to type VARIANT in XAccessibleObject. Note we cannot directly cast enums/structs to VARIANT so these need to be first casted to what they really represent e.g. int or nint before casting to VARIANT.
Other changes include:

  • Convert methods: UiaDisconnectProvider , UiaHostProviderFromHwnd , UiaRaiseAutomationEvent, UiaRaiseAutomationPropertyChangedEvent, UiaRaiseNotificationEvent , UiaRaiseStructureChangedEvent , UiaReturnRawElementProvider to Cswin32
  • Add IsWindows10_1709OrGreater() API since UiaRaiseNotificationEvent requires it. We didn't have this check before, so I also kept old definition of UiaRaiseNotificationEvent in cases where the OS version requirement is not met
  • Add new constructor to SafeArrayScope that takes an array and add test
  • Update XAccessibleObjectTests since GetPropertyValue no longer returns object

I tried to separate the test changes from the actual changes to make this somewhat easier to digest for review.

Microsoft Reviewers: Open in CodeFlow

@lonitra lonitra requested a review from a team as a code owner October 23, 2023 19:13
@ghost ghost assigned lonitra Oct 23, 2023
Copy link
Member

@Tanya-Solyanik Tanya-Solyanik left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great!

@lonitra lonitra merged commit 383225d into dotnet:main Nov 3, 2023
@ghost ghost added this to the 9.0 Preview1 milestone Nov 3, 2023
@lonitra lonitra deleted the elementprovider branch November 3, 2023 18:11
gpetrou pushed a commit to gpetrou/winforms that referenced this pull request Nov 3, 2023
* Convert IRawElementProviderSimple to Cswin32

* Add tests and fix XAccessibleObjectTests

* more test updates

* Use Cswin32 definition of ProviderOptions

* Remove s_notificationEventAvailable from AccessibleObject and only use OS check

* Preserve sig and update Interop.AccessibleObject tests

* Place 1709 OSCheck inside PInvoke

* Remove nint -> VARIANT operator and return VT_I4 VARIANTs for handles

* use IUnknown* -> VARIANT explicit operator

* Add VARIANT.True and VARIANT.False

* Add WindowHandleToVariant helper method

* address other feedback

* remove unused variable

* remove unused using

* Update VARIANT.True and VARIANT.False

* Update new file TreeViewLabelEditAccessibleObjectTests

* clean up

* Add more detail doc and add debug assert

* Remove locale from link
@github-actions github-actions bot locked and limited conversation to collaborators Dec 4, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants