Newsgroups : Borland : borland.public.delphi.nativeapi.win32 : 2007 Dec : Scope of TimeBeginPeriod(1)
| Subject: | Scope of TimeBeginPeriod(1) |
| Posted by: | "David" (david.markie@nospam.com) |
| Date: | Mon, 17 Dec 2007 16:01:52 |
I am investigating improving the accuracy of a TEvent.WaitFor(APeriod) by
using a MMSystem.TimeBeginPeriod(1) call.
I have seen differing recommendations about calling TimeBeginPeriod(1):-
a) some say the calls should be minimized and can be made once in
application.OnCreate matched by a TimeEndPeriod(1) in application.OnDestroy
due to the effect of TimeBeginPeriod(1) being per application/process
b) others say the each time sensitive call should be enclosed in a try
finally
TimeBeginPeriod(1);
try
AnEvent,WaitFor(APeriod)
finally
TimeEndPeriod(1);
end;
As the TimeBeginPeriod(1) could be invalidated by a call to
TimeBeginPeriod(xx) by another application.
Is either of the above correct or is the situation not this simple<g>
Thanks
David