コード例 #1
0
        private static async void SetGlowingForActiveWindow()
        {
            await Task.Delay(2500);

            var hWnd       = User32.GetForegroundWindow();
            var appHandles = Application.Current.Windows
                             .OfType <Window>()
                             .Select(x => PresentationSource.FromVisual(x) as HwndSource)
                             .Where(x => x != null)
                             .Select(x => x.Handle)
                             .ToArray();

            if (appHandles.All(x => x != hWnd))
            {
                var external = new ExternalWindow(hWnd);
                var chrome   = new WindowChrome();
                chrome.Attach(external);
            }
        }