Skip to content

Commit 9a442d7

Browse files
authored
Merge pull request #1850 from rubberduck-vba/revert-1848-next
Revert "Changed ActivateWindow to send WM_MDIACTIVATE instead of simulated mo…"
2 parents 3591bee + 51a259e commit 9a442d7

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

Rubberduck.VBEEditor/NativeMethods.cs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,9 +84,11 @@ 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_MDIACTIVATE = 0x0222;
87+
const int WM_MOUSEACTIVATE = 0x21;
88+
const int HTCAPTION = 2;
89+
const int WM_LBUTTONDOWN = 0x201;
8890

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

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

0 commit comments

Comments
 (0)