private void SendParentNotify(IntPtr child, Msg cause, int x, int y)
{
Hwnd hwnd;
if (child == IntPtr.Zero)
{
return;
}
hwnd = Hwnd.GetObjectFromWindow(child);
if (hwnd == null)
{
return;
}
if (hwnd.Handle == IntPtr.Zero)
{
return;
}
if (ExStyleSet((int)hwnd.initial_ex_style, WindowExStyles.WS_EX_NOPARENTNOTIFY))
{
return;
}
if (hwnd.Parent == null)
{
return;
}
if (hwnd.Parent.Handle == IntPtr.Zero)
{
return;
}
if (cause == Msg.WM_CREATE || cause == Msg.WM_DESTROY)
{
SendMessage(hwnd.Parent.Handle, Msg.WM_PARENTNOTIFY, Control.MakeParam((int)cause, 0), child);
}
else
{
SendMessage(hwnd.Parent.Handle, Msg.WM_PARENTNOTIFY, Control.MakeParam((int)cause, 0), Control.MakeParam(x, y));
}
SendParentNotify(hwnd.Parent.Handle, cause, x, y);
}