I got this working example from EE to wait for User input (keyboard and Mouse):
Local iTime As Integer, iLast As Integer
Local plii As String, cLast As String
Declare Integer GetTickCount In kernel32
Declare Short GetLastInputInfo In win32API String @ plii
iTime = GetTickCount()
plii = Chr(8) + Replicate(Chr(0), 7)
cLast = GetLastInputInfo(@plii)
iLast = (Asc(Substr(plii, 8, 1)) * 16777216) + ;
(Asc(Substr(plii, 7, 1)) * 65536) + ;
(Asc(Substr(plii, 6, 1)) * 256) + ;
Asc(Substr(plii, 5, 1))
iTime is the milliseconds your computer has been on.
iLast is the milliseconds your computer was on when your last keystroke or mousemove was.
To get minutes idle:
TotTime=(m.iTime - m.iLast) / 1000
The above example checks only user inputs (Keyboard and Mouse) but as per MS Article the system is idle only if the following conditions are not true:
The System Idle Task Scheduler service monitors for the system to be idle. The system is considered to be idle if for the last 10 minutes:
There is no user input.
The CPU and disk usage is less than 10 percent.
Question: My question is that how I know if the system is idle in Visual Foxpro based on the above conditions (CPU and Disk Usages)?