How to use FlashWindow in C# to blink the form's caption bar?

Posted by Ddd under Windows Forms category on | Points: 40 | Views : 9606
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
//add this namespace
using System.Runtime.InteropServices;

namespace WindowsFormsApplication1
public partial class Form5 : Form
public Form5()
//Use DLLImport for user32.dll

static extern void FlashWindow(IntPtr a, bool b);
//IntPtr structure:
//It is used to represent a pointer or a handle.

//call the function FlashWindow() passing the Handle property of the
//window to be 'flashed' and boolean value set to true.
void dd(Form w)
FlashWindow(w.Handle, true);
private void Form5_Load(object sender, EventArgs e)
//initialize w variable
Form k = this;


//Output:the form caption bar will blink once. To keep it continuously
//blnking , use a Timer.



Comments or Responses

Login to post response