C# Tutorials and offshore development in India
    Tutorials   Resources   Forum   Reviews   Communities   Interview   Jobs   Projects   Training   Your Ad Here    
Silverlight Games | Mentor | Code Converter | Articles | Code Factory | Computer Jokes | Members | Peer Appraisal | IT Companies | Bookmarks | Polls | Revenue Sharing | Lobby | Gift Shop |


Prizes & Awards
My Profile



Active Members
TodayLast 7 Days more...






Forums » .NET » .NET »

Automatic lock after 30 mts, if the app remains idle


Posted Date: 21 Nov 2008      Posted By: Lakshmi      Member Level: Gold     Points: 1   Responses: 2



Hi friends,


How to lock the software after 30 mts, if the application not used by the user.

For ex: the user is working and during its lunch break, (after 30 mts) the application should be locked automatically. Again the lock should be released after the user login in again.

Could anybody guide me how to achieve the above concept with vb.net2005 coding?



Thanks in advance





Responses

Author: Praveen    21 Nov 2008Member Level: DiamondRating: 2 out of 52 out of 5     Points: 6

private void Form1_Deactivate(object sender, EventArgs e)
{
timer1.Stop();
timer1.Enabled = false;
MessageBox.Show("From Deactivated");
}



private void Form1_Activated(object sender, EventArgs e)
{
if (!(timer1.Enabled))
{
timer1.Enabled = true;
//MessageBox.Show("From Activated and in Timer");
timer1.Interval = 10000*30;
timer1.Tick += new EventHandler(timer1_Tick);
timer1.Start();
}
}

void timer1_Tick(object sender, EventArgs e)
{
//here u can forcably logout the current user and redirect to login page
}

and dont give message box to check as it self it losting focus and hope ur req is for windows application

hope this will ehlp u



Author: Legend     21 Nov 2008Member Level: SilverRating: 2 out of 52 out of 5     Points: 5

private void Form1_Deactivate(object sender, EventArgs e)
{
timer1.Stop();
timer1.Enabled = false;
MessageBox.Show("From Deactivated");
}



private void Form1_Activated(object sender, EventArgs e)
{
if (!(timer1.Enabled))
{
timer1.Enabled = true;
//MessageBox.Show("From Activated and in Timer");
timer1.Interval = 10000*30;
timer1.Tick += new EventHandler(timer1_Tick);
timer1.Start();
}
}



Post Reply

 This thread is locked for new responses. Please post your comments and questions as a separate thread.
If required, refer to the URL of this page in your new post.


Next : Throw a remainder msg during login time
Previous : Alert box
Return to Discussion Forum
Post New Message
Category: .NET

Related Messages



dotNet Slackers

About Us    Contact Us    Privacy Policy    Terms Of Use