Skip to content

Commit 926c3e3

Browse files
committed
Merge branch 'next' of https://github.com/rubberduck-vba/Rubberduck into SourceControlLogging
2 parents 0e1f4c7 + fb67486 commit 926c3e3

File tree

1 file changed

+16
-2
lines changed

1 file changed

+16
-2
lines changed

RetailCoder.VBE/Common/RubberduckHooks.cs

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -216,9 +216,23 @@ private IntPtr WindowProc(IntPtr hWnd, uint uMsg, IntPtr wParam, IntPtr lParam)
216216
try
217217
{
218218
var suppress = false;
219-
if (hWnd == _mainWindowHandle && (WM)uMsg == WM.HOTKEY)
219+
switch ((WM) uMsg)
220220
{
221-
suppress = HandleHotkeyMessage(wParam);
221+
case WM.HOTKEY:
222+
suppress = hWnd == _mainWindowHandle && HandleHotkeyMessage(wParam);
223+
break;
224+
case WM.SETFOCUS:
225+
Attach();
226+
break;
227+
case WM.NCACTIVATE:
228+
if (wParam == IntPtr.Zero)
229+
{
230+
Detach();
231+
}
232+
break;
233+
case WM.CLOSE:
234+
Detach();
235+
break;
222236
}
223237

224238
return suppress

0 commit comments

Comments
 (0)