Click here to Skip to main content
15,891,905 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,

I need assistance or focus that auto log off web application through windows ActiveX control in c#. It is feasible to do. And idea related to it.

Thanks,
Brinda
Posted

1 solution

Hi,
you can achieve this using timer control in C#.NET , before that generate Deactivate & Activated event for Window form and implement below in that
C#
 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
    }
}
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900