Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

In Activity of Mouse and Keyboard

Status
Not open for further replies.

ChrisAgius

Programmer
Sep 27, 2000
51
MT
I developed an application and I want to include a screen saver in my application. Is there a way ... an api function or something to check for how long the mouse and keyboard were left inactive.

Thanks A Lot.
 
The following steps will help you to achieve that...
1. Introduce form level variable nLastKeyWhen
2. Form InitEvent
ThisForm.nLastKeyWhen=SYS(2)
3. a. Insert a timer control in the form just like txtBox or editBox. Timer control will be invisible when the form is run.
b. Set the timer controls INTERVAL value to somethng less than half your idle key time value... or let it be one minute. Remeber to set this value in milliseconds.
c. In the TimerEvent put the code
IF ThisForm.nLastKeyWhen + YourIdleTime > SYS(2) &&Youridle time is the screen saver activation idle time
DO FORM myScreenSaverForm
ENDIF
4. In the KeyPressEvent of the form put the code
ThisForm.nLastKeyWhen = SYS(2)
DODEFAULT
5. Create a modal form myScreenSaverForm and set its background to 0,0,0 or to your screen saver image. In this forms GotFocusEvent... put the code ....
IF INKEY(0,&quot;M&quot;) <> 0
ThisForm.Release()
ENDIF
Hope this helps you. :)
ramani :-9
(Subramanian.G)
FoxAcc
ramani_g@yahoo.com
 
Follow up on my above postings....
1. Remember to set the MyScreenSaverForm maximized and without header or such window style form min/max..buttons.
2. When the screen saver form is released, the older form gets activated. In the got focus event of that form, reset the nLastKeyWhen = SYS(2).
ramani :-9
(Subramanian.G)
FoxAcc
ramani_g@yahoo.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top