Skip to content

Commit 7016470

Browse files
authored
Merge pull request #130 from VelixoSolutions/bugfix/124-arguments-tooltip-regression
#124 Troubleshoot IntelliSense arguments tooltip not appearing issue …
2 parents e7871ef + 62d1811 commit 7016470

File tree

2 files changed

+10
-5
lines changed

2 files changed

+10
-5
lines changed

Source/ExcelDna.IntelliSense/UIMonitor/WinEvents.cs

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,9 @@ void HandleWinEvent(IntPtr hWinEventHook, WinEvent eventType, IntPtr hWnd,
190190
if (_hWndFilterOrZero != IntPtr.Zero && hWnd != _hWndFilterOrZero)
191191
return;
192192

193-
if (!IsSupportedWinEvent(eventType) || idObject == WinEventObjectId.OBJID_CURSOR || hWnd == IntPtr.Zero)
193+
if (!IsSupportedWinEvent(eventType, idObject)
194+
|| idObject == WinEventObjectId.OBJID_CURSOR
195+
|| hWnd == IntPtr.Zero)
194196
return;
195197

196198
// Moving the GetClassName call here where the main thread is running.
@@ -209,7 +211,7 @@ void HandleWinEvent(IntPtr hWinEventHook, WinEvent eventType, IntPtr hWnd,
209211
}
210212

211213
// A quick filter that runs on the Excel main thread (or other thread handling the WinEvent)
212-
bool IsSupportedWinEvent(WinEvent winEvent)
214+
bool IsSupportedWinEvent(WinEvent winEvent, WinEventObjectId idObject)
213215
{
214216
return winEvent == WinEvent.EVENT_OBJECT_CREATE ||
215217
// winEvent == WinEvent.EVENT_OBJECT_DESTROY || // Stopped watching for this, because we can't route using the ClassName and don't really need anymore
@@ -219,6 +221,10 @@ bool IsSupportedWinEvent(WinEvent winEvent)
219221
winEvent == WinEvent.EVENT_SYSTEM_MOVESIZESTART || // Only for the on-demand hook
220222
winEvent == WinEvent.EVENT_SYSTEM_MOVESIZEEND || // Only for the on-demand hook
221223
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) ||
222228
winEvent == WinEvent.EVENT_SYSTEM_CAPTURESTART;
223229
}
224230

Source/ExcelDna.IntelliSense/UIMonitor/WindowWatcher.cs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ internal WindowChangedEventArgs(IntPtr windowHandle, WinEventHook.WinEvent winEv
6969
case WinEventHook.WinEvent.EVENT_OBJECT_FOCUS:
7070
Type = ChangeType.Focus;
7171
break;
72+
case WinEventHook.WinEvent.EVENT_OBJECT_LOCATIONCHANGE:
7273
case WinEventHook.WinEvent.EVENT_SYSTEM_MOVESIZEEND:
7374
Type = ChangeType.LocationChange;
7475
break;
@@ -151,9 +152,7 @@ public WindowWatcher(SynchronizationContext syncContextAuto, SynchronizationCont
151152
// EVENT_OBJECT_SELECTIONREMOVE
152153
// EVENT_OBJECT_SELECTIONWITHIN
153154
// EVENT_OBJECT_STATECHANGE (0x800A = 32778)
154-
// NB: Including the next event 'EVENT_OBJECT_LOCATIONCHANGE (0x800B = 32779)' will cause the Excel main window to lag when dragging.
155-
// This drag issue seems to have been introduced with an Office update around November 2022.
156-
_windowStateChangeHooks.Add(new WinEventHook(WinEventHook.WinEvent.EVENT_OBJECT_CREATE, WinEventHook.WinEvent.EVENT_OBJECT_STATECHANGE, syncContextAuto, syncContextMain, IntPtr.Zero));
155+
_windowStateChangeHooks.Add(new WinEventHook(WinEventHook.WinEvent.EVENT_OBJECT_CREATE, WinEventHook.WinEvent.EVENT_OBJECT_LOCATIONCHANGE, syncContextAuto, syncContextMain, IntPtr.Zero));
157156
_windowStateChangeHooks.Add(new WinEventHook(WinEventHook.WinEvent.EVENT_SYSTEM_CAPTURESTART, WinEventHook.WinEvent.EVENT_SYSTEM_CAPTURESTART, syncContextAuto, syncContextMain, IntPtr.Zero));
158157

159158
foreach (var windowStateChangeHook in _windowStateChangeHooks)

0 commit comments

Comments
 (0)