// Create an Accessible object; may return null internal static Accessible Create(IntPtr hwnd, int idObject, int idChild) { IAccessible acc = null; object child = null; if (UnsafeNativeMethods.AccessibleObjectFromEvent(hwnd, idObject, idChild, ref acc, ref child) != 0 /*S_OK*/ || acc == null) { return(null); } // Per SDK must use the ppacc and pvarChild from AccessibleObjectFromEvent // to access information about this UI element. return(new Accessible(acc, child)); }