Native class of objects from WinControl?

I am trying to take a WinTable object and pass it into my own object type as such:

CustomControl control = (CustomControl) this.UIMap.UIMainWindow.UICustomControl.NativeElement; 

Then I want to process the resulting CustomControl , as in the source code for my program, for example control.DoAThing() , I already referenced the .dll containing the CustomControl class, but the problem is that .NativeElement; is a return type of Object[] , not Object , as the definition of a function says it should be.

Is there a .NativeElement way to go or I don’t understand its purpose?

UPDATE: I checked the types of objects in the resulting Object[] , and the first one is of type System.__ComObject , and the second is of type System.Int32 , but I'm not sure which one represents ...

+6
source share
1 answer

It would be helpful if you posted your code for the CustomControl and UICustomControl . Based on my vague understanding of your problem, the following may work: try and publish the results.

 object[] native = this.UIMap.UIMainWindow.UICustomControl.NativeElement as object[]; if ((native[0] != null) && (native[0] is IAccessible)) { IAccessible a = native[0] as IAccessible; if (a is CustomControl) CustomControl control = (CustomControl)a; } 
0
source

Source: https://habr.com/ru/post/947037/


All Articles