39 lines
1.2 KiB
C#
39 lines
1.2 KiB
C#
using System.Runtime.InteropServices; // これが必要!
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
|
|
namespace KssSmaPlaLib.Alert
|
|
{
|
|
// --- ここからコピー ---
|
|
[StructLayout(LayoutKind.Sequential)]
|
|
public struct FLASHWINFO
|
|
{
|
|
public uint cbSize; public IntPtr hwnd; public uint dwFlags;
|
|
public uint uCount; public uint dwTimeout;
|
|
}
|
|
|
|
public static class WindowFlasherUxer
|
|
{
|
|
[DllImport("user32.dll")]
|
|
[return: MarshalAs(UnmanagedType.Bool)]
|
|
private static extern bool FlashWindowEx(ref FLASHWINFO pwfi);
|
|
|
|
public const uint FLASHW_ALL = 3; // タスクバーとウィンドウ両方
|
|
public const uint FLASHW_TIMERNOFG = 12; // 最前面に来るまで点滅し続ける
|
|
|
|
public static void Flash(IntPtr hWnd)
|
|
{
|
|
FLASHWINFO fInfo = new FLASHWINFO();
|
|
fInfo.cbSize = Convert.ToUInt32(Marshal.SizeOf(fInfo));
|
|
fInfo.hwnd = hWnd;
|
|
fInfo.dwFlags = FLASHW_ALL | FLASHW_TIMERNOFG;
|
|
fInfo.uCount = uint.MaxValue; // 無限に点滅
|
|
fInfo.dwTimeout = 0;
|
|
FlashWindowEx(ref fInfo);
|
|
}
|
|
}
|
|
}
|