protected override void WndProc(ref Message m)
{
try
{
if (m.Msg == uCallBackMsg)
{
switch (m.WParam.ToInt32())
{
case (int)ABNotify.ABN_FULLSCREENAPP:
{
if ((int)m.LParam == 1)
{
this.RunningFullScreenApp = true;
this.TopMost = false;
}
else
{
this.RunningFullScreenApp = false;
this.TopMost = true;
}
break;
}
default:
break;
}
}
switch (m.Msg)
{
case 0X46: //WM_WINDOWPOSCHANGING
WINDOWPOS windowPos = (WINDOWPOS)m.GetLParam(typeof(WINDOWPOS));
if (windowPos.x + windowPos.cx > rectangle_Screen.Right)
{
windowPos.x = rectangle_Screen.Right - windowPos.cx;
}
if (windowPos.y + windowPos.cy > rectangle_Screen.Bottom)
{
windowPos.y = rectangle_Screen.Bottom - windowPos.cy;
}
if (windowPos.x < rectangle_Screen.Top)
{
windowPos.x = rectangle_Screen.Top;
}
if (windowPos.y < rectangle_Screen.Left)
{
windowPos.y = 0;
}
Marshal.StructureToPtr(windowPos, m.LParam, false);
base.WndProc(ref m);
break;
default:
base.WndProc(ref m);
break;
}
}
catch (Exception ex)
{
log.WriteLog(ex.ToString());
}
}