Example #1
0
        public void HideFromPeek(IWindowWithHandle window)
        {
            var handle = window.RetrieveHandle();

            var attrValue = (int)DwmRenderingPolicy.Enabled;

            DwmNativeMethods.DwmSetWindowAttribute(handle, DwmWindowAttribute.ExcludedFromPeek, ref attrValue, sizeof(int));

            DwmNativeMethods.DwmSetWindowAttribute(handle, DwmWindowAttribute.DisallowPeek, ref attrValue, sizeof(int));
        }
        public void HideFromAppSwitch(IWindowWithHandle windowWithHandle)
        {
            var handle = windowWithHandle.RetrieveHandle();

            var index = (int)Gwl.GWL_EXSTYLE;

            var style = UserNativeMethods.GetWindowLong(handle, index);

            style |= (int)Ws.WS_EX_TOOLWINDOW;

            UserNativeMethods.SetWindowLong(handle, index, style);
        }