learned/learning/to learn RSS 2.0
# Thursday, 12 November 2009

This program prevents your system from getting locked even if it is left idle for time greater than your screen saver time. It basically presses ‘down’ arrow key every minute.

 

Create a Windows Forms Application and add a timer to the form.

 

public Form1()

{

    InitializeComponent();

    StartAction();

}

 

private void StartAction()

{

    // the timer is started and the form is minimized

    // set the timer interval as per your needs. I have set it to be 60000 milliseconds = 1 min

    timer_keypress.Enabled = true;

    this.WindowState = FormWindowState.Minimized;

    this.ShowInTaskbar = false;

}

 

 

To add the application to your system tray when minimized, add a notify icon from your toolbox to the forms and set properties appropriately. I chose an icon and changed the text property. By default this form will be in minimized state, as I have added code to do so in my StartAction function.

 

Add context menu from your toolbox to show menu when the system tray icon is right clicked. Right click contextMenuStrip and choose Edit items to add your menu items. Double click on the menu item to add a handler. I’ve added ‘Exit’ menu. Set your notify icon’s contextmenustrip property.

 

private void exitToolStripMenuItem_Click(object sender, EventArgs e)

{

    StopAction();

}

 

private void StopAction()

{

    // the timer is stopped and the form is closed  

    timer_keypress.Enabled = false;

    this.Close();

}

 

// this event will be triggered every minute

private void timer_keypress_Tick(object sender, EventArgs e)

{

    SendKeys.SendWait("{DOWN}");

}

 

There are many ways to do this, I found this one to be easy.


Here is the fileKeyPress.exe (889 KB)
Thursday, 12 November 2009 22:52:51 (GMT Standard Time, UTC+00:00)  #    Comments [0] -
.NET
Comments are closed.
Navigation
Archive
<2017 August>
SunMonTueWedThuFriSat
303112345
6789101112
13141516171819
20212223242526
272829303112
3456789
About the author/Disclaimer

Disclaimer
The opinions expressed herein are my own personal opinions and do not represent my employer's view in any way.

© Copyright 2017
Gokulnath
Sign In
Statistics
Total Posts: 41
This Year: 0
This Month: 0
This Week: 0
Comments: 47
Themes
Pick a theme:
All Content © 2017, Gokulnath
DasBlog theme 'Business' created by Christoph De Baene (delarou)
The new movement has made a number of changes. First, precise instantaneous jump calendar display tag heuer replica large switching time is scheduled for midnight. The power required for this process will slowly build up within hours. Furthermore, LANGE 1 escapement now available eccentric balance weight balance wheel and homemade free omega uk watch sprung. Means provided in the hand-carved balance wheel splint omega replica underneath, 21,600 vibrations per hour. This table also hublot replica retains the reliable double-barrel, power reserve of 72 hours.