Tiempo de inactividad

Tiempo de inactividad

Postby EBM » Mon Mar 25, 2019 1:07 pm

Hola a todos,

A ver si alguien me pudiera ayudar con este tema, necesito saber cuanto tiempo ha tenido mi aplicación sin actividad, básicamente tengo que controlar cuanto tiempo tiene mi aplicación que no recibe un click del mouse o que presionen una tecla, ya lo intente con oWnd:blClicked, bKeyDown, bRClicked, etc... pero solo funciona si estoy en la ventana principal y si lo hago sobre el área "cliente" de dicha ventana, al abrir un dialogo o sobre el mismo menú de la ventana ya no evalua los bloques de eventos, existe alguna manera "global" de controlar los clicks del mouse y el que presionen una tecla?

Cualquier idea es bienvenida

Saludos!

Eduardo Borondón Muñiz
EBM
 
Posts: 147
Joined: Tue Oct 11, 2005 8:22 pm
Location: Guadalajara, Jal Mexico

Re: Tiempo de inactividad

Postby karinha » Mon Mar 25, 2019 1:25 pm

João Santos - São Paulo - Brasil - Phone: +55(11)95150-7341
User avatar
karinha
 
Posts: 7214
Joined: Tue Dec 20, 2005 7:36 pm
Location: São Paulo - Brasil

Re: Tiempo de inactividad

Postby EBM » Mon Mar 25, 2019 6:22 pm

Hola Karinha,

Gracias por responder, tu ejemplo funciona bien pero lo hace para la inactividad de la PC, lo que necesito es controlar la inactividad de mi sistema, te explico el problema para ver si tienes alguna solución:

Los empleados de la empresa se ponen a usar la PC para ver diferentes cosas como navegar en la web, checar el face, ver videos, etc.... y dejan de hacer su trabajo en el sistema, no puedo bloquear el uso del navegador por que requieren consultar alguna info, lo que queremos es detectar si dejan de usar el sistema por mas de X tiempo y que en automatico el sistema genere una notificación de que ese empleado no esta haciendo su trabajo.

Es posible que el ejemplo que me compartiste se pueda modificar a que solo detecte inactividad en mi sistema? Solo requiero "monitorear" los clicks del mouse y las pulsaciones de teclado.

Saludos y gracias por tu interés

Eduardo Borondón Muñiz
EBM
 
Posts: 147
Joined: Tue Oct 11, 2005 8:22 pm
Location: Guadalajara, Jal Mexico

Re: Tiempo de inactividad

Postby carlos vargas » Tue Mar 26, 2019 1:31 am

3.13.11 Idle state

Idle state this is a state of expectation, when the Harbour program is waiting for the input from the user with the keyboard or the mouse. It arises as the result of Inkey() function call ( the READ command uses Inkey(), so that while waiting for input GET-objects idle state occurs ). In this state, there is an automatic collect of the garbage and any background tasks can be carried out. To add/remove these background tasks the following functions are designed (example of usage see in the harbour/tests/testidle.prg):

nHandle := hb_IdleAdd( bAction ) Codeblock bAction is added to the list of background tasks for execition during idle state. The function returns nHandle, which can be used to remove tasks in the list.
bAction := hb_IdleDel( nHandle ) The task nHandle is removed from the list of background tasks, nHandle - value returned by the function hb_IdleAdd() when adding tasks. The function returns codeblock the corresponding th the task , or Nil if such a task is not in the list.
hb_IdleState() As a result of performing this function the program is included in the idle state, performs garbage collection and performs one of background tasks list. As a result of successive calls of the function the background tasks are performed in the queue. This function has sense, if you have a long process without waiting States, and you have to interrupt it to perform background tasks.
hb_IdleSleep( nSeconds ) As a result of performing of this function the program is included in the idle state for nSeconds seconds. In contrast to the Inkey(nSeconds) the standby condition is not interrupted when you enter by the keyboard.
Salu2
Carlos Vargas
Desde Managua, Nicaragua (CA)
User avatar
carlos vargas
 
Posts: 1683
Joined: Tue Oct 11, 2005 5:01 pm
Location: Nicaragua

Re: Tiempo de inactividad

Postby EBM » Tue Mar 26, 2019 1:21 pm

Carlos,

Muchas gracias por la información, creo que por ahí esta la solución que busco.

Saludos!

Eduardo Borondón Muñiz
EBM
 
Posts: 147
Joined: Tue Oct 11, 2005 8:22 pm
Location: Guadalajara, Jal Mexico


Return to FiveWin para Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 80 guests