Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Delays

Posted on 1997-03-26
4
Medium Priority
?
497 Views
Last Modified: 2010-04-06
How can I program delay-Routines, like the delay shipped with Borland pascal? I need delays down to microseconds.

Thanks
0
Comment
Question by:hoffi
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
4 Comments
 
LVL 3

Expert Comment

by:mheacock
ID: 1334967
The MMSYSTEM dll comes with very fine timer utilities, but will only get down to a single millisecond.  I don't know of anything that will get you down to microseconds.

I'll watch the answer tho...I'll be curious if this is possible at that fine a resolution.
0
 
LVL 3

Expert Comment

by:sperling
ID: 1334968
As mheacock's already really answered the question, I'll submit this as a comment...

You can get an approx. maximum timing resolution of 10ms using timers, or repeated calls to GetTickCount.

You can get an maximum resolution of 1ms using multimedia timers...

Finer resolution is possible, though, using drivers to reprogram the hardware timer, and so on... That's a heck of a lot of work, and it'll slow down the system *a lot*. It might be possible to do it in user-mode, I do believe I once read an article about how to get 100-200 ns resolution without drivers... Not sure though.

You might wan't to ask your question in the MS-Windows Programming topic area, as this ain't something you'll be able to do in Delphi anyway.

Regards,

Erik.
0
 

Accepted Solution

by:
slash earned 300 total points
ID: 1334969
OK !!!
Here goes some code, like :

procedure delay(msec:integer);
var first_t:integer;
begin
 first_t:=GetTickCount;
 while ...
  Application.ProcessMesage()
end.

// something like this ... stand by for more
0
 

Expert Comment

by:pam032697
ID: 1334970
i prefer not to use Application.ProcessMessage.

under NT 4.0 the Task Manager reports a 100% userProcessor used when you have Application.ProcessMessage. I will use the win32 function sleep() instead with a small number.

just use the windows unit, and use sleep(MilliSecond).
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…
Suggested Courses

604 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question