Skip to content

Commit 3cea15f

Browse files
committed
Fix PopupList when already IntelliSense loaded late
IntelliSenseServer v 0.0.4
1 parent 280439a commit 3cea15f

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

Source/ExcelDna.IntelliSense/IntelliSenseServer.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ namespace ExcelDna.IntelliSense
4747
// REMEMBER: COM events are not necessarily safe macro contexts.
4848
public static class IntelliSenseServer
4949
{
50-
const string ServerVersion = "0.0.3"; // TODO: Define and manage this somewhere else
50+
const string ServerVersion = "0.0.4"; // TODO: Define and manage this somewhere else
5151

5252
// NOTE: Do not change these constants in custom versions.
5353
// They are part of the co-operative safety mechanism allowing different add-ins providing IntelliSense to work together safely.

Source/ExcelDna.IntelliSense/UIMonitor/PopupListWatcher.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,8 @@ void _windowWatcher_PopupListWindowChanged(object sender, WindowWatcher.WindowCh
5757
try
5858
{
5959
// DO we need to remove...?
60-
Automation.RemoveAutomationPropertyChangedEventHandler(_popupList, PopupListBoundsChanged);
60+
if (_popupList != null)
61+
Automation.RemoveAutomationPropertyChangedEventHandler(_popupList, PopupListBoundsChanged);
6162
}
6263
catch (Exception ex)
6364
{
@@ -74,6 +75,7 @@ void _windowWatcher_PopupListWindowChanged(object sender, WindowWatcher.WindowCh
7475
if (_popupList == null)
7576
{
7677
Logger.WindowWatcher.Verbose($"PopupList automation initialize");
78+
_hwndPopupList = e.WindowHandle;
7779
_popupList = AutomationElement.FromHandle(_hwndPopupList);
7880
// We set up the structure changed handler so that we can catch the sub-list creation
7981
InstallEventHandlers();

0 commit comments

Comments
 (0)