Kotlik Posted January 3, 2019 Posted January 3, 2019 Hello, I'm using UIA wrappers to find elements. This is the minimal example: #include "UIAWrappers.au3" ; .... Local $arr[2], $pCondition, $orCondition $UIA_oUIAutomation.createPropertyCondition($UIA_AutomationIdPropertyId, $ids[0], $pCondition) $arr[0] = ObjCreateInterface($pCondition, $sIID_IUIAutomationPropertyCondition, $dtagIUIAutomationPropertyCondition) $UIA_oUIAutomation.createPropertyCondition($UIA_AutomationIdPropertyId, $ids[1], $pCondition) $arr[1] = ObjCreateInterface($pCondition, $sIID_IUIAutomationPropertyCondition, $dtagIUIAutomationPropertyCondition) Local $res = $UIA_oUIAutomation.CreateOrConditionFromNativeArray($arr, 2, $orCondition) ConsoleWrite(Hex($res)) I'm trying to pass array as an parameter to createOrConditionFromNativeArray, but $res (HRESULT) returns this error code: 0x80004003 E_POINTER Pointer that is not valid By documentation, CreateOrConditionFromNativeArray takes pointer to the array. The question is - should I convert it somehow so I can pass it to IUIAutomation object? Or is there some other issue? Note: There is CreateOrCondition method, which works fine with $arr[0] and $arr[1] references. It does not work only with array version.
LarsJ Posted January 3, 2019 Posted January 3, 2019 I think that a native array means a C-type array. You create C-type arrays with DllStruct functions. Something like this (untested): $tCArray = DllStructCreate( "ptr[2]" ) DllStructSetData( $tCArray, 1, $pCondition1, 1 ) DllStructSetData( $tCArray, 1, $pCondition2, 2 ) $res = $UIA_oUIAutomation.CreateOrConditionFromNativeArray(DllStructGetPtr( $tCArray ), 2, $orCondition) Note that this is not .NET functions. This is Windows API functions: Overview docu, Reference docu Controls, File Explorer, ROT objects, UI Automation, Windows Message MonitorCompiled code: Accessing AutoIt variables, DotNet.au3 UDF, Using C# and VB codeShell menus: The Context menu, The Favorites menu. Shell related: Control Panel, System Image ListsGraphics related: Rubik's Cube, OpenGL without external libraries, Navigating in an image, Non-rectangular selectionsListView controls: Colors and fonts, Multi-line header, Multi-line items, Checkboxes and icons, Incremental searchListView controls: Virtual ListViews, Editing cells, Data display functions
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now