Eso Amigos, quiero poner un timer que empice a contar cuando dejen de usar el teclado o raton, tipo los protectores de pantalla, tendran algo parecido?
gracias
// How to create a screensaver that will be executed when a GET is not used for some time
#include "FiveWin.ch"
static nTime := 0
function Main()
local oDlg, oSay, oGet, cTest := Space( 10 )
DEFINE DIALOG oDlg TITLE "Test"
@ 0.5, 8 SAY oSay PROMPT "Elapsed time: " + AllTrim( Str( nTime ) ) + " secs."
@ 3, 7 GET oGet VAR cTest PASSWORD
ACTIVATE DIALOG oDlg CENTERED ;
ON INIT BuildTimer( oDlg, oSay, oGet )
return nil
function BuildTimer( oDlg, oSay, oGet )
local oTmr
DEFINE TIMER oTmr OF oDlg ;
ACTION ( nTime++, oSay:Refresh(), If( nTime > 14, ScreenSaver(),)) INTERVAL 1000
ACTIVATE TIMER oTmr
oGet:bKeyDown = { | nKey | nTime := 0, nKey }
return nil
function ScreenSaver()
static oDlg
nTime = 0
if oDlg == nil
ShowWindow( FindWindow( "Shell_TrayWnd", "" ), 0 ) // Taskbar
ShowWindow( FindWindow( "Button", "Start" ), 0 ) // Vista round button
DEFINE DIALOG oDlg STYLE WS_VISIBLE COLOR "W/B" SIZE GetSysMetrics( 0 ), GetSysMetrics( 1 )
@ 10, 10 SAY "This is a screensaver" COLOR "W/B"
oDlg:bKeyDown = { || oDlg:End() }
ACTIVATE DIALOG oDlg ;
ON CLICK oDlg:End()
ShowWindow( FindWindow( "Shell_TrayWnd", "" ), 1 )
ShowWindow( FindWindow( "Button", "Start" ), 1 )
oDlg = nil
nTime = 0
endif
return nil
Return to FiveWin para Harbour/xHarbour
Users browsing this forum: Google [Bot] and 50 guests