@@ -190,9 +190,7 @@ void HandleWinEvent(IntPtr hWinEventHook, WinEvent eventType, IntPtr hWnd,
190190 if ( _hWndFilterOrZero != IntPtr . Zero && hWnd != _hWndFilterOrZero )
191191 return ;
192192
193- if ( ! IsSupportedWinEvent ( eventType , idObject )
194- || idObject == WinEventObjectId . OBJID_CURSOR
195- || hWnd == IntPtr . Zero )
193+ if ( ! IsSupportedWinEvent ( eventType ) || idObject == WinEventObjectId . OBJID_CURSOR || hWnd == IntPtr . Zero )
196194 return ;
197195
198196 // Moving the GetClassName call here where the main thread is running.
@@ -211,7 +209,7 @@ void HandleWinEvent(IntPtr hWinEventHook, WinEvent eventType, IntPtr hWnd,
211209 }
212210
213211 // A quick filter that runs on the Excel main thread (or other thread handling the WinEvent)
214- bool IsSupportedWinEvent ( WinEvent winEvent , WinEventObjectId idObject )
212+ bool IsSupportedWinEvent ( WinEvent winEvent )
215213 {
216214 return winEvent == WinEvent . EVENT_OBJECT_CREATE ||
217215 // winEvent == WinEvent.EVENT_OBJECT_DESTROY || // Stopped watching for this, because we can't route using the ClassName and don't really need anymore
@@ -221,10 +219,6 @@ bool IsSupportedWinEvent(WinEvent winEvent, WinEventObjectId idObject)
221219 winEvent == WinEvent . EVENT_SYSTEM_MOVESIZESTART || // Only for the on-demand hook
222220 winEvent == WinEvent . EVENT_SYSTEM_MOVESIZEEND || // Only for the on-demand hook
223221 winEvent == WinEvent . EVENT_OBJECT_SELECTION || // Only for the PopupList
224- // NB: Including the next event 'EVENT_OBJECT_LOCATIONCHANGE (0x800B = 32779)' without the check for 'OBJID_CARET'
225- // will cause the Excel main window to lag when dragging.
226- // This drag issue seems to have been introduced with an Office update around November 2022.
227- ( winEvent == WinEvent . EVENT_OBJECT_LOCATIONCHANGE && idObject == WinEventObjectId . OBJID_CARET ) ||
228222 winEvent == WinEvent . EVENT_SYSTEM_CAPTURESTART ;
229223 }
230224
0 commit comments