forked from Rampastring/Rampastring.Tools
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathWindowFlasher.cs
More file actions
40 lines (34 loc) · 1.02 KB
/
WindowFlasher.cs
File metadata and controls
40 lines (34 loc) · 1.02 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
using System;
using Windows.Win32;
using Windows.Win32.UI.WindowsAndMessaging;
using Windows.Win32.Foundation;
namespace Rampastring.Tools;
public static class WindowFlasher
{
/// <summary>
/// Flashes a form's window in the taskbar.
/// </summary>
/// <param name="windowHandle">The handle of the window to flash.</param>
/// <returns>The return value fo FlashWindowEx.</returns>
#if NET5_0_OR_GREATER
[System.Runtime.Versioning.SupportedOSPlatform("windows5.1.2600")]
#endif
public static bool FlashWindowEx(IntPtr windowHandle)
{
int cbSize;
unsafe
{
cbSize = sizeof(FLASHWINFO);
}
var pfwi = new FLASHWINFO
{
cbSize = (uint)cbSize,
hwnd = (HWND)windowHandle,
dwFlags = FLASHWINFO_FLAGS.FLASHW_ALL | FLASHWINFO_FLAGS.FLASHW_TIMERNOFG,
uCount = uint.MaxValue,
dwTimeout = 0u
};
BOOL result = PInvoke.FlashWindowEx(pfwi);
return result.Value != 0;
}
}