Precise DelaysGetTickCount()... TicksTarget = GetTickCount() + 100 ' Wait 100 ticks while (GetTickCount() < TicksTarget) : Wend
This produces a delay much longer than 100 ticks. Can you tell me why I'm not getting the results I expected?
From: Larry Johnson
Email: larryj@voyageronline.net
The other consideration is that the frequency with which VB is given processing time will vary, dependant upon your operating system. For example, under Windows 3.11 your application will be given processing time at most every 55 ticks, under Windows 95 this drops to a mere 13 ticks.
Under normal circumstances running this code under Windows 3.11 this code should execute for 110 ticks (2 * 55 ticks). However, if something else is hogging processing time, your app may not get a chance to call GetTickCount until much later.
You might want to consider any VBXs you are using or the JET engine as possible sources of the processing delay. The JET engine likes to use time detected as unused to run what it classes as background processing, this would involve cleaning up temporary tables, memory de-allocation and other such wonders.
Essentially, what I am saying is that you are using appropriate code which is being prevented from working by an outside source. Have a close look at what processes are running and try the same code with minimal other processes, then add them one by one until you detect which one is causing the problem. You might also want to take this approach with parts of your project, remove some of your VBXs or database engine activities. And then re-add them one by one. It's laborious but it may just help you determine what is causing the problem.