Try intercepting the calls, like this;
using System;
using System.Windows;
using System.Windows.Interop;
namespace WpfApplication23
{
public partial class MainWindow : Window
{
public MainWindow()
{
InitializeComponent();
SourceInitialized += Window1_SourceInitialized;
}
private void Window1_SourceInitialized(object sender, EventArgs e)
{
WindowInteropHelper helper = new WindowInteropHelper(this);
HwndSource source = HwndSource.FromHwnd(helper.Handle);
source.AddHook(WndProc);
}
private IntPtr WndProc(IntPtr hwnd, int msg, IntPtr wParam, IntPtr lParam, ref bool handled)
{
const int WM_SYSCOMMAND = 0x0112;
const int SC_MOVE = 0xF010;
switch (msg)
{
case WM_SYSCOMMAND:
int command = wParam.ToInt32() & 0xfff0;
if (command == SC_MOVE)
{
handled = true;
}
break;
default:
break;
}
return IntPtr.Zero;
}
}
}
Hope this helps,
Fredrik