The MARGINS structure should be:
[StructLayout(LayoutKind.Sequential)]
public strict MARGINS
{
public int cxLeftWidth;
public int cxRightWidth;
public int cyTopHeight;
public int cyBottomHeight;
}
DwmExtendFrameIntoClientArea
should be supported in Vista. I assume that Win7 is just being more tolerant of the truncated structure. Be very careful with unmanaged data types.