回复 8楼 sam_jiang
能否提供一个简单地编码?
[此贴子已经被作者于2023-1-18 09:16编辑过]
DECLARE long GetLastInputInfo IN user32 string@ of = CREATEOBJECT("Form1") of.show(1) CLEAR ALL RETURN DEFINE CLASS Form1 As Form AutoCenter=1 AllowOutput=0 nLastInputTime = 0 nLastTime = 0 ADD OBJECT Timer1 AS Timer WITH Interval=1000 ADD OBJECT Text1 AS TextBox WITH Top=10,Left=10,Value=0 PROCEDURE Timer1.Timer IF INT(thisform.myGetLastInputInfo()/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.myGetLastInputInfo()/1000) thisform.nLastTime = INT(SECONDS()) thisform.Text1.Value = 0 ENDIF ENDPROC FUNCTION myGetLastInputInfo LOCAL lii lii = 0h0800000000000000 && struct LASTINPUTINFO GetLastInputInfo(@lii) RETURN CTOBIN(RIGHT(lii, 4), "4RS") ENDFUNC ENDDEFINE