Skip to content

Commit e4ba56a

Browse files
committed
Changed ActivateWindow to send WM_MDIACTIVATE instead of simulated mouse events.
1 parent 4ace3ae commit e4ba56a

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

Rubberduck.VBEEditor/NativeMethods.cs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -84,11 +84,9 @@ internal static string GetWindowTextByHwnd(IntPtr windowHandle)
8484
/// <param name="parentWindowHandle"> Handle of the parent window. </param>
8585
internal static void ActivateWindow(IntPtr windowHandle, IntPtr parentWindowHandle)
8686
{
87-
const int WM_MOUSEACTIVATE = 0x21;
88-
const int HTCAPTION = 2;
89-
const int WM_LBUTTONDOWN = 0x201;
87+
const int WM_MDIACTIVATE = 0x0222;
9088

91-
SendMessage(windowHandle, WM_MOUSEACTIVATE, parentWindowHandle, new IntPtr(HTCAPTION + WM_LBUTTONDOWN * 0x10000));
89+
SendMessage(parentWindowHandle, WM_MDIACTIVATE, windowHandle, IntPtr.Zero);
9290
}
9391

9492
internal static void EnumChildWindows(IntPtr parentWindowHandle, EnumChildWindowsDelegate callBackEnumWindows)

0 commit comments

Comments
 (0)