public static IntPtr TillDesktop(this IntPtr self) { var p = Win32ApiWrapper.GetParent(self); if (p == IntPtr.Zero || p == desktop) { return(self); } return(TillDesktop(p)); }
public static bool SameOrBelongTo(this IntPtr self, IntPtr target) { if (self == target) { return(true); } var p = Win32ApiWrapper.GetParent(self); if (p.ToInt32() == 0) { return(false); } if (p == target) { return(true); } return(SameOrBelongTo(p, target)); }