C#C
C#2y ago
Pandetthe

✅ Wndproc is not receiving any messages when window is not focused

HI! I am trying to handle messages in WPF using WndProc like this:
_messageWindowHandle = new WindowInteropHelper(window).EnsureHandle();
HwndSource.FromHwnd(_messageWindowHandle).AddHook(WndProc);

When window is focused everything is working fine, but when I select another window, wndproc stop receiving any messages. How can I fix it?
Was this page helpful?