Hi!
I'm trying to adapt piece of code found here to set time limit for user to enter something in command prompt.
I wrote something like this:
Local $tBuffer = DllStructCreate("char"), $nRead, $sRet = ""
Local $hFile = _WinAPI_CreateFile("CON", 2, 2)
$start = TimerInit()
While TimerDiff($start) < 10000
_WinAPI_ReadFile($hFile, DllStructGetPtr($tBuffer), 1, $nRead)
If DllStructGetData($tBuffer, 1) = @CR Then ExitLoop
If $nRead > 0 Then $sRet &= DllStructGetData($tBuffer, 1)
WEnd
But it doesn't work. Command prompt waits endlessly for input.
I've tried changing "TimerDiff($start) < 10000 " to "if TimerDiff($start) > 10000 Then ExitLoop " but it seems like condition is not even evaluated.
Am I missing something?