以下是引用吹水佬在2015-3-22 23:05:42的发言:
示例:
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
我的表单不是用prg文件定义的,里面的自定义函数代码要放到哪个事件中