문제

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);
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top