怎样监测表单中一定明间内有无鼠标键盘动作
怎样监测表单中一定明间内有无鼠标键盘动作
DECLARE LONG GetLastInputInfo IN User32 STRING@ oForm = CREATEOBJECT("Form1") oForm.Show(1) READ EVENTS RELEASE ALL CLEAR DLLS RETURN DEFINE CLASS Form1 As Form nLastInputTime = 0 nLastTime = 0 ADD OBJECT Timer1 AS Timer WITH Interval=1000 ADD OBJECT Text1 AS TextBox WITH Top=100,Left=120,Value=0 PROCEDURE UnLoad CLEAR EVENTS ENDPROC PROCEDURE Timer1.Timer IF INT(thisform._GetLastInputInfo()/1000) == thisform.nLastInputTime IF (INT(SECONDS()) - thisform.nLastTime) > 10 MESSAGEBOX("鼠标键盘无动作超过10秒关闭退出") thisform.Release ELSE thisform.Text1.Value = thisform.Text1.Value + 1 ENDIF ELSE thisform.nLastInputTime = INT(thisform._GetLastInputInfo()/1000) thisform.nLastTime = INT(SECONDS()) thisform.Text1.Value = 0 ENDIF ENDPROC FUNCTION _GetLastInputInfo LOCAL stLII stLII = 0h0800000000000000 GetLastInputInfo(@stLII) RETURN CTOBIN(RIGHT(stLII, 4), "4RS") ENDFUNC ENDDEFINE