I want to write a while
loop with a timeout like follows... How to write this in Inno Setup?
InitialTime = SystemCurrentTime ();
Timeout = 2000; //(ms)
while (!condition) {
if (SystemCurrentTime () - InitialTime > Timeout) {
// Timed out
break;
}
}
Thanks!
To make it simple in Inno Setup, you can use
GetTickCount
calls.So, it will not timeout exactly at 2000 milliseconds (or whatever value you want) but close enough to be acceptable.
Other limitation you must be aware of is:
In code, it shows like this:
The above function is not perfect, in the rare case of that being running at the moment the counter overflows (once each 49.7 days of the machine is continuously running), because it will timeout as soon as the overflow occurs (maybe before the desired wait).