I've written a WndProc
to know if current Window is flashing. It is as follows:
private IntPtr WndProc(IntPtr hwnd, int msg, IntPtr wParam, IntPtr lParam, ref bool handled)
{
var retVal = IntPtr.Zero;
switch (msg)
{
case (int)WindowsMessages.NCACTIVATE:
retVal = WindowsNative.DefWindowProc(hwnd, WindowsMessages.NCACTIVATE, new IntPtr(1), new IntPtr(-1));
IsFlashing = (int)wParam == 0;
break;
}
return retVal;
}
Now this is working perfectly with any Window
except for when their SizeToContent
property is set to Height
(I haven't tested WidthAndHeight
but I assume it won't work either); in which case, the WM_NCACTIVATE
message is not sent to the Window
at all. All of my windows are using custom look and feel (using WPF WindowChrome). Do you possibly know the reason or can help me with this problem?