diff --git a/FloatingStatusWindow.sln.DotSettings b/FloatingStatusWindow.sln.DotSettings
new file mode 100644
index 0000000..c960585
--- /dev/null
+++ b/FloatingStatusWindow.sln.DotSettings
@@ -0,0 +1,2 @@
+
+ True
\ No newline at end of file
diff --git a/Library/MainWindow.xaml.cs b/Library/MainWindow.xaml.cs
index 44a2193..4bbfc72 100644
--- a/Library/MainWindow.xaml.cs
+++ b/Library/MainWindow.xaml.cs
@@ -77,6 +77,14 @@ internal partial class MainWindow
WindowSettings.Apply();
}
+ protected override void OnSourceInitialized(EventArgs e)
+ {
+ base.OnSourceInitialized(e);
+
+ var windowHandle = new WindowInteropHelper(this).Handle;
+ WindowManager.AllowMessagesThroughFilter(windowHandle);
+ }
+
protected override IntPtr WndProc(IntPtr hwnd, int msg, IntPtr wParam, IntPtr lParam, ref bool handled)
{
if (msg == WindowManager.SetLockMessage)
diff --git a/Library/WindowManager.cs b/Library/WindowManager.cs
index e9e1aaf..faf4555 100644
--- a/Library/WindowManager.cs
+++ b/Library/WindowManager.cs
@@ -1,5 +1,4 @@
-using ChrisKaczor.Wpf.Windows;
-using System;
+using System;
using System.Collections.Generic;
using System.Runtime.InteropServices;
using System.Text;
@@ -10,6 +9,11 @@ public static partial class WindowManager
{
private delegate bool EnumWindowsProc(IntPtr hWnd, IntPtr lParam);
+ private enum ChangeWindowMessageFilterExAction : uint
+ {
+ Allow = 1
+ }
+
[LibraryImport("user32.dll")]
[return: MarshalAs(UnmanagedType.Bool)]
private static partial void EnumWindows(EnumWindowsProc lpEnumFunc, IntPtr lParam);
@@ -26,6 +30,10 @@ public static partial class WindowManager
[LibraryImport("user32.dll", EntryPoint = "SendMessageW")]
private static partial void SendMessage(IntPtr hWnd, uint msg, IntPtr wParam, IntPtr lParam);
+ [LibraryImport("user32.dll", SetLastError = true)]
+ [return: MarshalAs(UnmanagedType.Bool)]
+ private static partial void ChangeWindowMessageFilterEx(IntPtr hWnd, uint msg, ChangeWindowMessageFilterExAction action, IntPtr changeInfo);
+
private const string WindowMessageSetLock = "FloatingStatusWindowLibrary_SetLock";
private const string WindowMessageClose = "FloatingStatusWindowLibrary_Close";
@@ -43,6 +51,12 @@ public static partial class WindowManager
private static List _windowList;
private static IntPtr _excludeHandle;
+ public static void AllowMessagesThroughFilter(IntPtr hWnd)
+ {
+ ChangeWindowMessageFilterEx(hWnd, SetLockMessage, ChangeWindowMessageFilterExAction.Allow, IntPtr.Zero);
+ ChangeWindowMessageFilterEx(hWnd, CloseMessage, ChangeWindowMessageFilterExAction.Allow, IntPtr.Zero);
+ }
+
public static List GetWindowList()
{
lock (WindowLocker)