I have an AutomationElement A
(MS UI Automation), which represents a combo box. I want to select n-th item in that combo box using Windows API call
IntPtr ComboBox_SetCurSel(IntPtr hWnd, int index)
A.NativeWindowHandle
contains the handle of the combo box, but in order to pass it to ComboBox_SetCurSel
, I need to convert it from int
to IntPtr
.
How?
Use the IntPtr(int)
constructor.
IntPtr WindowHandle = new IntPtr(A.Current.NativeWindowHandle);