// OnEventSystemMenuPopupStart - process an EventSystemMenuPopupStart WinEvent. private void OnEventSystemMenuPopupStart(int eventId, IntPtr hwnd, int idObject, int idChild, uint eventTime) { Accessible acc = Accessible.Create(hwnd, idObject, idChild); if (acc == null) { return; } HandleFocusChange(hwnd, acc, idObject, idChild, eventTime); }
// OnEventObjectFocus - process an EventObjectFocus WinEvent. private void OnEventObjectFocus(int eventId, IntPtr hwnd, int idObject, int idChild, uint eventTime) { Accessible acc = Accessible.Create(hwnd, idObject, idChild); if (acc == null) { return; } // Keep track of last focused non-menu item, so we can restore focus when we leave menu mode if (!_fInMenu) { _accLastBeforeMenu = acc; _hwndLastBeforeMenu = hwnd; _idLastObject = idObject; _idLastChild = idChild; } HandleFocusChange(hwnd, acc, idObject, idChild, eventTime); }
// OnEventSystemCaptureEnd - process an EventSystemCaptureEnd WinEvent. private void OnEventSystemCaptureEnd(int eventId, IntPtr hwnd, int idObject, int idChild, uint eventTime) { // Deal only with Combolbox dropdowns... if (Accessible.IsComboDropdown(hwnd)) { SafeNativeMethods.GUITHREADINFO guiThreadInfo = new SafeNativeMethods.GUITHREADINFO(); if (!Misc.GetGUIThreadInfo(0, ref guiThreadInfo)) { return; } Accessible acc = Accessible.Create(guiThreadInfo.hwndFocus, UnsafeNativeMethods.OBJID_CLIENT, 0); if (acc == null) { return; } HandleFocusChange(hwnd, acc, idObject, idChild, eventTime); } }
// OnEventSystemCaptureStart - process an EventSystemCaptureStart WinEvent. private void OnEventSystemCaptureStart(int eventId, IntPtr hwnd, int idObject, int idChild, uint eventTime) { // Deal only with Combolbox dropdowns... if (Accessible.IsComboDropdown(hwnd)) { // Need to get id of focused item... try { IntPtr i = Misc.SendMessageTimeout(NativeMethods.HWND.Cast(hwnd), UnsafeNativeMethods.LB_GETCURSEL, IntPtr.Zero, IntPtr.Zero); Accessible acc = Accessible.Create(hwnd, UnsafeNativeMethods.OBJID_CLIENT, i.ToInt32() + 1); if (acc == null) { return; } HandleFocusChange(hwnd, acc, idObject, idChild, eventTime); } catch (TimeoutException) { // Ignore } } }