Yes, you have to use Win32 API. Here is an working example.
public class Form1 : System.Windows.Forms.Form
{
[StructLayout(LayoutKind.Sequential)]
internal struct FlashInfo
{
internal int cbSize;
internal IntPtr hWnd;
internal Int32 dwFlags;
internal Int32 uCount;
internal Int32 dwTimeout;
}
[DllImport("user32.dll")]
private static extern bool FlashWindowEx(IntPtr pwfi);
private const int FLASHW_STOP = 0;
private const int FLASHW_CAPTION = 0x00000001;
private const int FLASHW_TRAY = 0x00000002;
private const int FLASHW_ALL = (FLASHW_CAPTION | FLASHW_TRAY);
private const int FLASHW_TIMER = 0x00000004;
private const int FLASHW_TIMERNOFG = 0x0000000C;
private void CalcBtn_Click(object sender, System.EventArgs e)
{
FlashInfo wfi = new FlashInfo();
wfi.cbSize = Marshal.SizeOf(wfi.GetType());
wfi.dwFlags =FLASHW_ALL;
wfi.dwTimeout = 100;
wfi.hWnd = this.Handle;
wfi.uCount = 100;
IntPtr ptr = Marshal.AllocCoTaskMem(wfi.cbSize);
Marshal.StructureToPtr(wfi, ptr, true);
FlashWindowEx(ptr);
//...
//Marshal.FreeCoTaskMem(ptr);
}
//..
}
-obislavu-