private void SetWindowLong(long? add, long? remove)
{
IntPtr _hwnd = new WindowInteropHelper(this).Handle;
bool _32bit = IntPtr.Size == 4;
long _style;
if (_32bit)
{
_style = NativeMethods.GetWindowLong(_hwnd, WND_STYLE.GWL_EXSTYLE);
}
else
{
_style = NativeMethods.GetWindowLongPtr(_hwnd, WND_STYLE.GWL_EXSTYLE);
}
if (add.HasValue)
{
_style |= add.Value;
}
if (remove.HasValue)
{
_style &= ~remove.Value;
}
if (_32bit)
{
NativeMethods.SetWindowLong(_hwnd, WND_STYLE.GWL_EXSTYLE, _style);
}
else
{
NativeMethods.SetWindowLongPtr(_hwnd, WND_STYLE.GWL_EXSTYLE, _style);
}
}