private void Form_Activated(object sender, EventArgs e)
{
timer1.Stop();
timer1.Enabled = false;
}
private void Form_Deactivate(object sender, EventArgs e)
{
timer1.Enabled = true;
timer1.Tick += new EventHandler(timer1_Tick);
timer1.Interval = 10000; // interval is in miliseconds .. current interval is for 10 sec
timer1.Start();
}
void timer1_Tick(object sender, EventArgs e)
{
if (timer1.Interval == 10000) // once there window found still deactivated for perticular interval
{
timer1.Stop();
this.Close(); // here you can log off the user & call the new window
}
}