Frage

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?

War es hilfreich?

Lösung

Use the IntPtr(int) constructor.

IntPtr WindowHandle = new IntPtr(A.Current.NativeWindowHandle);
Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top