did you try handling WM_GETMINMAXINFO or WM_WINDOWPOSCHANGING and see what happens?